Skip to content

A3D_QuaternionToEuler

imshooter edited this page Oct 17, 2026 · 1 revision

Turn a quaternion, such as one from GetVehicleRotationQuat, into the rotation of an object.

native bool:A3D_QuaternionToEuler(
    Float:w,
    Float:x,
    Float:y,
    Float:z,
    &Float:rx,
    &Float:ry,
    &Float:rz
);

Parameters

Parameter Description
Float:w Real part of the quaternion.
Float:x Part of the X axis.
Float:y Part of the Y axis.
Float:z Part of the Z axis.
&Float:rx Rotation on the X axis.
&Float:ry Rotation on the Y axis.
&Float:rz Rotation on the Z axis.

Returns

  • true when the rotation was written.

Remarks

The reverse of A3D_EulerToQuaternion. It turns the rotation of a vehicle into the rotation of an object, on every axis, where the facing angle of a vehicle only gives the heading.

Example

Leaves a wreck turned exactly as the vehicle was, on a slope too.

stock LeaveWreck(vehicleid) {
    new
        Float:x,
        Float:y,
        Float:z,
        Float:w,
        Float:qx,
        Float:qy,
        Float:qz,
        Float:rx,
        Float:ry,
        Float:rz
    ;

    GetVehiclePos(vehicleid, x, y, z);
    GetVehicleRotationQuat(vehicleid, w, qx, qy, qz);
    A3D_QuaternionToEuler(w, qx, qy, qz, rx, ry, rz);

    return CreateObject(3593, x, y, z, rx, ry, rz);
}

Related

  • A3D_EulerToQuaternion: Turn the rotation of an object into a quaternion, in the order of GetVehicleRotationQuat.
  • A3D_GetVehicleOffsetPosition: Find where a point given relative to a vehicle lies in the world, as the vehicle stands and leans now.

Home

Guides

Reference

Functions

Creating objects
Motion
Placement
Behaviour
Display and data
Rays
Shapes
Players, vehicles and actors
Map probes
Screen
Map objects
Water
Models and surfaces
Rotations and offsets
Vehicles
Callbacks

Clone this wiki locally