[plz plyyz help +rep] quaternion to euler -
Baltazar - 08.11.2013
Need a function, that converts quaternion rotation to euler angles
Re: plz help quaternion help plz plz -
Babul - 08.11.2013
have a look here:
https://sampforum.blast.hk/showthread.php?tid=455269
^ found it within 30 seconds after going to the plugin section. grrrr
Re: plz help quaternion help plz plz -
SAMProductions - 08.11.2013
What is your Problem ?
Having the Quaternion Stuff ?
Re: plz help quaternion help plz plz -
SAMProductions - 08.11.2013
Try This :-
First of all,
Quaternion Converter Include:
Pastebin for Quaternion Converter
(
NOTE: Make sure you open the same PAWNO that contains all your stuff)
Download it here,
Pastebin for Quaternion Converter
Installation:
- Copy the whole include codes in Notepad, Wordpad, etc..
- Save it as "include's name.inc", and Save it in "PAWNO > include".
- Open your Gamemode Script using PAWNO Compiler.
- Add "#include <include's name>" at the Top of your Gamemode Script.
- Compile it, Save it, and Finish.
and/or
- Download the Include File, Copy it.
- Paste it in "PAWNO > include".
- Open your Gamemode Script using PAWNO Compiler.
- Add "#include <include's name>" at the Top of your Gamemode Script.
- Compile it, Save it, and Finish.
Functions :-
Код:
stock QuaternionToYawPitchRoll(Float:quat_w,Float:quat_x,Float:quat_y,Float:quat_z,&Float:x,&Float:y,&Float:z)
Takes the quaternion values specified by quat_w, quat_x, quat_y and quat_z, then converts them into roll, pitch and yaw (respectively) and saves them into the variables specified by x, y and z.
Код:
stock QuaternionGetRoll(Float:quat_w,Float:quat_x,Float:quat_y,Float:quat_z,&Float:roll)
Takes the quaternion values specified by quat_w, quat_x, quat_y and quat_z, then converts them into roll (respectively) and saves them into the variables specified by roll.
Код:
stock QuaternionGetPitch(Float:quat_w,Float:quat_x,Float:quat_y,Float:quat_z,&Float:pitch)
Takes the quaternion values specified by quat_w, quat_x, quat_y and quat_z, then converts them into pitch and saves them into the variables specified by pitch.
Код:
stock QuaternionGetYaw(Float:quat_w,Float:quat_x,Float:quat_y,Float:quat_z,&Float:yaw)
Takes the quaternion values specified by quat_w, quat_x, quat_y and quat_z, then converts them into yaw and saves them into the variable specified by yaw.
EDIT :-
Tell me if i am wrong
Re: plz help quaternion help plz plz -
Pottus - 08.11.2013
I'm not sure if that one will work, when I did this I got some specialized function it's on my other HD I just need to dig it out.
Ok I dug it out like from the depths of the forums lol.
I did have to use this once when making this include
https://sampforum.blast.hk/showthread.php?tid=415397
pawn Код:
QuatToEulerZXY(Float:quat_x, Float:quat_y, Float:quat_z, Float:quat_w, &Float:x, &Float:y, &Float:z)
{
x = -asin(2 * ((quat_x * quat_z) + (quat_w * quat_y)));
y = atan2(2 * ((quat_y * quat_z) + (quat_w * quat_x)), (quat_w * quat_w) - (quat_x * quat_x) - (quat_y * quat_y) + (quat_z * quat_z));
z = -atan2(2 * ((quat_x * quat_y) + (quat_w * quat_z)), (quat_w * quat_w) + (quat_x * quat_x) - (quat_y * quat_y) - (quat_z * quat_z));
return 1;
}
Source:
https://sampforum.blast.hk/showthread.php?tid=361844