Skip to content

A3D_GetPositionOffset

imshooter edited this page Oct 17, 2026 · 1 revision

Find where a point of the world lies relative to an object, the reverse of A3D_GetOffsetPosition.

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

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:worldX Point in the world on the X axis.
Float:worldY Point on the Y axis.
Float:worldZ Point 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.

Returns

  • true when the offset was written.

Remarks

The reverse of A3D_GetOffsetPosition: where a point of the world lies along the axes of an object.

Example

Tells whether a player stands in front of a cash machine, facing its screen.

stock bool:IsAtCashMachine(playerid, Float:x, Float:y, Float:z, Float:angle) {
    new
        Float:playerX,
        Float:playerY,
        Float:playerZ,
        Float:offsetX,
        Float:offsetY,
        Float:offsetZ
    ;

    GetPlayerPos(playerid, playerX, playerY, playerZ);
    A3D_GetPositionOffset(x, y, z, 0.0, 0.0, angle, playerX, playerY, playerZ, offsetX, offsetY, offsetZ);

    return offsetY > 0.3 && offsetY < 1.5 && floatabs(offsetX) < 0.5;
}

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_GetVehiclePositionOffset: Find where a point of the world lies relative to a vehicle, such as whether a player stands behind it.

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