Rotating the Axis

Hi Guys,



My requirement:

Having a shape which is placed wrt local axis. Local axis(Node) must be rotated, so that the shape(Geometry) which is placed is rotated automatically.



What I’m having:

Vectors of local axis to rotate ( X vector, Y vector, Y vector) and Node for the Local axis.



What i’m doing :

I’m applying the quaternion for the Node.I tried 2 different ways.

1)Quaternion.fromRotationMatrix();

2)Quaternion.fromAxes();



and then, tried to set this Quaternion to Node in 2 different ways.



1)Node.rotate(Quaternion);

2)Node.setLocalRotation(Quaternion).



Result:

No difference in the output of the rotation, even if i try all the combinations i mentioned above.





Please suggest me how to rotate the axis wrt to its parent axis.





Thanks & Regards,

Sha

You will have to show us your code.

If you are starting from no rotation then setLocal and rotate will both give the same results.



Your description isn’t really clear on what you are trying to achieve though.



Are you looking to have something spinning like a wheel on a vehicle (so always spinning the same relative to the vehicle not to the world) or something always spinning the same relative to the world no matter how the parent moves (like a gyroscope).

Thanks @pspeed and @zarch for the replies.



I fixed my problem.I set my quaternion values wrongly.Now , i’m getting results as expected.