Author Topic: mesh rotation and parent/child relationship  (Read 703 times)

Offline ap

  • byte
  • *
  • Posts: 12
    • View Profile
mesh rotation and parent/child relationship
« on: January 20, 2015, 02:24:25 pm »
Hello

I am trying to load an object from file (loader returns array of Object3D) then use a dummy object as a base node (parent) for all objects (setting them each a parent), and then aligning the rotation of the mesh of each one of objects.
Does "rotateMesh" use the inherited transformations from the parent in order to rotate the mesh?

I am rotating the base node in order to set the right rotation, then call "rotateMesh" on all children, and then clearing the rotation from the parent.
I think this doesn't work as expected, am I missing something?

Thanks
A.P.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12017
    • View Profile
    • http://www.jpct.net
Re: mesh rotation and parent/child relationship
« Reply #1 on: January 20, 2015, 05:39:21 pm »
rotateMesh() doesn't take the parent's rotations into account.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12017
    • View Profile
    • http://www.jpct.net
Re: mesh rotation and parent/child relationship
« Reply #2 on: January 20, 2015, 05:44:06 pm »
If all you do are rotations, try to call getWorldTransformation() on the children, set the result as rotation matrix of the child and then call rotateMesh()...and then, of course, reset the rotation and remove the parent.