Skip to content

A3D_GetOffsetRotation

imshooter edited this page Oct 17, 2026 · 1 revision

Find the rotation in the world of something turned relative to an object, such as an object attached to another.

native bool:A3D_GetOffsetRotation(
    Float:rx,
    Float:ry,
    Float:rz,
    Float:offsetRX,
    Float:offsetRY,
    Float:offsetRZ,
    &Float:worldRX,
    &Float:worldRY,
    &Float:worldRZ
);

Parameters

Parameter Description
Float:rx Rotation of the object on the X axis.
Float:ry Rotation on the Y axis.
Float:rz Rotation on the Z axis.
Float:offsetRX Rotation relative to the object on the X axis.
Float:offsetRY Relative rotation on the Y axis.
Float:offsetRZ Relative rotation on the Z axis.
&Float:worldRX Rotation in the world on the X axis.
&Float:worldRY Rotation on the Y axis.
&Float:worldRZ Rotation on the Z axis.

Returns

  • true when the rotation was written.

Remarks

The relative rotation is applied in the frame of the object, the way an attached object turns with what it is attached to. Together with A3D_GetOffsetPosition, it places an object on another without attaching it.

Example

Stacks a crate on another, a quarter turn around, however the lower crate is turned.

stock StackCrate(Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz) {
    new
        Float:topX,
        Float:topY,
        Float:topZ,
        Float:topRX,
        Float:topRY,
        Float:topRZ
    ;

    A3D_GetOffsetPosition(x, y, z, rx, ry, rz, 0.0, 0.0, 0.7, topX, topY, topZ);
    A3D_GetOffsetRotation(rx, ry, rz, 0.0, 0.0, 90.0, topRX, topRY, topRZ);

    return CreateObject(1271, topX, topY, topZ, topRX, topRY, topRZ);
}

Related

  • A3D_GetOffsetPosition: Find where a point given relative to an object lies in the world, such as a spot on a table or the end of a ramp.
  • A3D_GetLookRotation: Find the rotation that turns the front of an object, its Y axis, to a point, such as a camera or a turret.

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