www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: gamerfan on September 08, 2011, 09:29:27 am

Title: Calculating rotation angle
Post by: gamerfan on September 08, 2011, 09:29:27 am
Hi,
I am rotating a box and want to calculate the rotation angle for every point that it rotates in 3d world.The box rotates on Y-axis.How can I do that? Thanks in advance
Title: Re: Calculating rotation angle
Post by: EgonOlsen on September 08, 2011, 09:33:30 am
The angle between...what? I'm not sure what you mean with "rotation angle for every point"?
Title: Re: Calculating rotation angle
Post by: gamerfan on September 08, 2011, 09:42:01 am
The box rotates on y-axis.so every time when I press a key it rotates on y-axis. At that point can we know how much angle swept by this 'rotation'.Is it clear now?  :)
Title: Re: Calculating rotation angle
Post by: EgonOlsen on September 08, 2011, 09:51:33 am
You can use this method: http://www.jpct.net/jpct-ae/doc/com/threed/jpct/SimpleVector.html#calcAngle(com.threed.jpct.SimpleVector) (http://www.jpct.net/jpct-ae/doc/com/threed/jpct/SimpleVector.html#calcAngle(com.threed.jpct.SimpleVector)) to calculate the angle between (0,0,1) and box.getZAxis(). However, try to avoid working with angles if possible. Matrices are far superior.
Title: Re: Calculating rotation angle
Post by: gamerfan on September 08, 2011, 10:55:12 am
Thanks it worked.I used box.getTransformedCenter().calcAngle(box.getXAxis()) this will return angle swept by the rotation