How to calculate this angle

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

How to calculate this angle

Post by Magnet »

I have rotation angle and vector.
How to calculate angle between them ("? - required angle")
Image
Warchief
Posts: 204
Joined: Tue Nov 22, 2005 10:58 am

Post by Warchief »

Calculate angle from the vector X to the normal (vector with angle 0, which should be 1,0 for 2D or 1,0,0 or 0,0,1 for 3D with Y upwards, depending the anle you need).

You may use acos( X dot Normal ) to get the angle (without sign) or atan2( X.y, X.x ) [for 2D. 3D-> z,x or x,z] to get it signed. Then substract the alpha angle.
Warchief's Warboard 3D Now hotseat release
Post Reply