[SOLVED] Need a Rotation trick in Cinematics

Hey guys,



I am using cinematics to run a trace file for an animation. I have a type of car that has a flat platter on top of it. The spatial has 2 nodes the actual car and the platter.



I want to be able to control the car’s movement in 2 different events , 1 - rotate without the platter and 2 - rotate with the platter.



Rotating with the platter is easy as all I have to do is rotate the whole spatial:

[java]

cinematic.addCinematicEvent(trigger_time, new RotationTrack(spatialToMove, rotation_angle, rot_duration / (animation_speed)));

[/java]



Rotating without the platter seems a little bit tricky and me thinking it was simple it took me hours to trace the problem back to here. I used:

[java]

cinematic.addCinematicEvent(trigger_time, new RotationTrack(((Node) spatialToMove).getChild(0), rotation_angle, rot_duration / (animation_speed))); // where getChild(0) is the car so I am rotating the car w/o the platter

[/java]



this caused a major bug as the RotationTrack will now deal with the current angle of the platter rather than the angle of the car whenever triggered causing wrong animation.



Then I tried:

[java]

cinematic.addCinematicEvent(trigger_time, new RotationTrack(spatialToMove, rotation_angle, rot_duration / (animation_speed)));

cinematic.addCinematicEvent(trigger_time, new RotationTrack(((Node) spatialToMove).getChild(0), rotation_angle2, rot_duration / (animation_speed))); // where getChild(0) is the car so I am rotating the car w/o the platter

[/java]



thinking that I can first rotate the whole spatial then rotate back the platter for the position it’s supposed to be in, after → no , what happens is the the whole spatial rotates than the spatial’s platter barely rotate to get back to the same position of the car.

1 Like

That definitely worked! Thanks!!!

1 Like

if i understand correctly you have this kind of node structure :



->spatialToMove

|-> platter

|-> car



I guess your rotation-angle is a rotation in world space, am i right?



What happens here is that the rotation of the platter is combined to the world rotation of its parent (spatialToMove).

What you should do is to rotate each child alone and never rotate the parent.

first case rotate both the car and splatter node

2nd case rotate only the splatter.

2 Likes