[HLF]Southclaw
Unregistered
Quote:
Originally Posted by Joe Staff
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); }
|
I'm trying to learn about Quaternions my brain finds it about as difficult as trying to percept an extra dimension!
I understand there's an extra "rotation dimension" to stop "gimbal lock" but what is the 'w' or "scalar" parameter.
Is there any way I can make a visual representation in SA:MP to help me understand these damn things!?