Skip to content

A3D_GetOffsetPosition

imshooter edited this page Oct 17, 2026 · 1 revision

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.

The offset follows the axes of the object, which turn with it.

native bool:A3D_GetOffsetPosition(
    Float:x,
    Float:y,
    Float:z,
    Float:rx,
    Float:ry,
    Float:rz,
    Float:offsetX,
    Float:offsetY,
    Float:offsetZ,
    &Float:worldX,
    &Float:worldY,
    &Float:worldZ
);

Parameters

Parameter Description
Float:x Position of the object on the X axis.
Float:y Position on the Y axis.
Float:z Position on the Z axis.
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:offsetX Offset along the X axis of the object.
Float:offsetY Offset along its Y axis.
Float:offsetZ Offset along its Z axis.
&Float:worldX The point in the world on the X axis.
&Float:worldY The point on the Y axis.
&Float:worldZ The point on the Z axis.

Returns

  • true when the point was written.

Remarks

The offset is given along the axes of the object, which turn with it: X to its right, Y to its front and Z up, as an object without rotation has them. The result is the place in the world, the same one AttachObjectToObject would use for that offset.

Example

Seats four chairs around a table, however the table is turned.

stock SeatChairs(Float:x, Float:y, Float:z, Float:angle) {
    static const Float:gSeats[4][2] = {
        { 0.0, 1.0 },
        { 0.0, -1.0 },
        { 1.0, 0.0 },
        { -1.0, 0.0 }
    };

    new
        Float:seatX,
        Float:seatY,
        Float:seatZ
    ;

    for (new i; i != sizeof (gSeats); ++i) {
        A3D_GetOffsetPosition(x, y, z, 0.0, 0.0, angle, gSeats[i][0], gSeats[i][1], 0.0, seatX, seatY, seatZ);
        CreateObject(1720, seatX, seatY, seatZ, 0.0, 0.0, angle);
    }
}

Related

  • A3D_GetPositionOffset: Find where a point of the world lies relative to an object, the reverse of A3D_GetOffsetPosition.
  • A3D_GetOffsetRotation: Find the rotation in the world of something turned relative to an object, such as an object attached to another.
  • 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
Routes
Route display
Walking
Callbacks

Clone this wiki locally