www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: tollos on June 12, 2013, 05:28:54 pm

Title: Rotation on group of objects
Post by: tollos on June 12, 2013, 05:28:54 pm
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 :

Code: [Select]
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 !



Title: Re: Rotation on group of objects
Post by: tollos on June 13, 2013, 11:04:57 am
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 ;-)
Title: Re: Rotation on group of objects
Post by: EgonOlsen on June 13, 2013, 03:46:09 pm
That's what i would have suggested anyway... :)