Author Topic: How does the (Object3D)parent affect the children?  (Read 1933 times)

Offline kiffa

  • long
  • ***
  • Posts: 199
    • View Profile
How does the (Object3D)parent affect the children?
« on: August 27, 2012, 04:17:46 pm »
My codes:

Code: [Select]
   
    Object3D mDog = xxxxxx; //Loader init
    Object3D obj =  Object3D.createDummyObj();
    obj.addChild(mDog);
    obj.addChild(otherObjs);
    obj.rotateY(1);

   if(mDog.getRotationMatrix().isIdentity()){
      log.d("xx", "true");
  };

   if(mDog.getTranslationMatrix().isIdentity()){
      log.d("xx", "true2");
  };


The result is "true"、"true2".

I want to reset "mDog" to its original position after "obj.rotateY(1)",  and the code "mDog.clearRotation()" is useless. Doesn't the rotation of the parent-Object3D affect the RotationMatrix of children-Object3D?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: How does the (Object3D)parent affect the children?
« Reply #1 on: August 27, 2012, 09:39:09 pm »
The rotation of the parent affects the ROTATION of the child object but not it's ROTATION MATRIX. I.e. each object has it's own, separate rotation matrix but the world transformation of a child takes the parent't transformation into account.