Rotation on group of objects

Started by tollos, June 12, 2013, 05:28:54 PM

Previous topic - Next topic

tollos

Hello,

I'm currently working on my own animation module for my game. Very simple stuff with only textured rectangles and pivot nodes.
I don't want to use Bones or any other tool, the objective is to make mine ... and to avoid using any 3D modeling tools since I'm totally bad at modeling  ;-)

My problem is about rotations. If I have a character with head, torso, legs, arms, ... and I need to perform a rotation on the whole character I have no idea how to do it (without using setChild()).
I have a "main" object, the head in this case and this one turns perfectly with something like that :


Matrix mat = new Matrix( target.calcSub( head.gettranslatedCenter()).normalize()).getRotationMatrix() );
head.setRotationMatrix(mat);


But my problem are the other Object3D of the model, if I apply the same they just turn to the correct direction on their center axis but without moving of course.
I was thinking about a rotation on the Y axis, but no idea how to compute the angle they should turn.

Thanks in advance !




tollos

Forget about it, by adding all my model's parts to the reference one (the head) as addChild() it works perfectly for movement and rotations ;-)

EgonOlsen

That's what i would have suggested anyway... :)