07.05.2012, 06:25
Not sure if already posted, but here are 2 functions/formulas that I direly needed.
pawn Code:
#define PI 3.14159265
stock Float:ToRadian(Float:Degrees)return Degrees*(PI/180);
//This was set for On Foot Recording Files usage, maybe be different when used with something else
stock EulerToQuaternion(Float:angle,&Float:w,&Float:x,&Float:y,&Float:z) //Angle = Z rotation
{
new Float:c1,Float:c2,Float:c3,Float:s1,Float:s2,Float:s3;
c1=floatcos(0.0); //"Heading" -- Just guessing, but I think X rotation goes here
c2=floatcos(ToRadian(angle)/2); //"Attitude" -- Definitely Z
c3=floatcos(0.0); //"Bank" -- Possibly Y rotation
s1=floatsin(0.0);
s2=floatsin(ToRadian(angle)/2);
s3=floatsin(0.0);
w=(c1*c2*c3)-(s1*s2*s3);
x=(s1*s2*c3)+(c1*c2*s3);
y=(s1*c2*c3)+(c1*s2*s3);
z=(c1*s2*c3)-(s1*c2*s3);
}