Advertisement

Getting the angle that a vectori is making with a plane...

Started by July 12, 2003 02:20 PM
1 comment, last by cippyboy 21 years, 7 months ago
Actually the plane is 0,0,0 and infinite... So I ask is like this : I have a vector(let`s say 2D for the simplicity),and i want to know the angle it makes with the x axis ... ^ | / |/a --------> | | ^ I don`t know if my text paiting will show the case..but it`s pretty simple to understand..i`ve treyd the acos function(s) and it`s not actually working.. edit: Well the code I use (now) is this : CVector3 Dif=ControlPoints[nextCP]-ControlPoints[prevCP]; Dif=Dif/framesbetween; Pos=Pos+Dif; curentframe++; float dst=sqrt(Dif.x*Dif.x+Dif.z*Dif.z);//y was taken... because I need the y axis rotation not on all of the, although I might try 2.(rotation axis)..hm... float rad=acos(Dif.x/dst);//I tryed either x or z almost the same,actaully with z it works better float degrees=rad*180.0f;//Like this right ? a radian is 180 degress...I think ?

Relative Games - My apps

Acos, as implemented in programming languages, returns it''s value in radians, not degrees.

Niko Suni

Advertisement
There are 2*pi radians in 360 degrees.

degrees = (180 * rad) / pi

This topic is closed to new replies.

Advertisement