Skip to content

A3D_GetVehicleOffsetPosition

imshooter edited this page Oct 17, 2026 · 1 revision

Find where a point given relative to a vehicle lies in the world, as the vehicle stands and leans now.

X points to the right of the vehicle, Y to its front and Z up.

native bool:A3D_GetVehicleOffsetPosition(
    vehicleid,
    Float:offsetX,
    Float:offsetY,
    Float:offsetZ,
    &Float:x,
    &Float:y,
    &Float:z
);

Parameters

Parameter Description
vehicleid Vehicle the offset belongs to.
Float:offsetX Offset along the X axis of the vehicle.
Float:offsetY Offset along its Y axis.
Float:offsetZ Offset along its Z axis.
&Float:x The point in the world on the X axis.
&Float:y The point on the Y axis.
&Float:z The point on the Z axis.

Returns

  • true when the point was written.
  • false when there is no such vehicle.

Remarks

The vehicle is taken where the server knows it now, with its whole rotation, so the offset follows the vehicle up slopes and when it rolls over. X points to the right of the vehicle, Y to its front and Z up, from the centre of the model.

Example

Drops a crate half a metre behind the boot of a vehicle.

stock DropBehind(vehicleid) {
    new
        Float:sizeX,
        Float:sizeY,
        Float:sizeZ,
        Float:x,
        Float:y,
        Float:z
    ;

    GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_SIZE, sizeX, sizeY, sizeZ);

    if (!A3D_GetVehicleOffsetPosition(vehicleid, 0.0, -sizeY / 2.0 - 0.5, 0.0, x, y, z)) {
        return;
    }

    A3D_CreateObject(1271, x, y, z, 0.0, 0.0, 0.0, 20.0);
}

Related

  • A3D_GetVehiclePositionOffset: Find where a point of the world lies relative to a vehicle, such as whether a player stands behind it.
  • A3D_GetVehiclePartPosition: Find where a part of a vehicle lies in the world, such as the boot for a player to open it or the petrol cap to refuel.
  • 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.

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