plz help quaternion help plz plz
#1

Need a function, that converts quaternion rotation to euler angles
Reply
#2

have a look here: https://sampforum.blast.hk/showthread.php?tid=455269
^ found it within 30 seconds after going to the plugin section. grrrr
Reply
#3

What is your Problem ?

Having the Quaternion Stuff ?
Reply
#4

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:
  1. Copy the whole include codes in Notepad, Wordpad, etc..
  2. Save it as "include's name.inc", and Save it in "PAWNO > include".
  3. Open your Gamemode Script using PAWNO Compiler.
  4. Add "#include <include's name>" at the Top of your Gamemode Script.
  5. Compile it, Save it, and Finish.
and/or
  1. Download the Include File, Copy it.
  2. Paste it in "PAWNO > include".
  3. Open your Gamemode Script using PAWNO Compiler.
  4. Add "#include <include's name>" at the Top of your Gamemode Script.
  5. 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
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)