Repository navigation
A3D_GetLookRotation
imshooter edited this page Oct 17, 2026
·
1 revision
Find the rotation that turns the front of an object, its Y axis, to a point, such as a camera or a turret.
native bool:A3D_GetLookRotation(
Float:x,
Float:y,
Float:z,
Float:targetX,
Float:targetY,
Float:targetZ,
&Float:rx,
&Float:ry,
&Float:rz
);| 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:targetX |
Point to face on the X axis. |
Float:targetY |
Point on the Y axis. |
Float:targetZ |
Point on the Z axis. |
&Float:rx |
Rotation on the X axis. |
&Float:ry |
Rotation on the Y axis. |
&Float:rz |
Rotation on the Z axis. |
-
truewhen the rotation was written. -
falsewhen both points are the same.
The front of an object is its Y axis, the way it faces with no rotation. The result tilts the front up or down to the point and then turns it to the heading of the point, with no roll, as a camera on a stand turns.
A security camera that follows a player.
forward @Camera_Follow(objectid, playerid);
public @Camera_Follow(objectid, playerid) {
new
Float:x,
Float:y,
Float:z,
Float:cameraX,
Float:cameraY,
Float:cameraZ,
Float:rx,
Float:ry,
Float:rz
;
GetPlayerPos(playerid, x, y, z);
GetObjectPos(objectid, cameraX, cameraY, cameraZ);
if (A3D_GetLookRotation(cameraX, cameraY, cameraZ, x, y, z, rx, ry, rz)) {
SetObjectRot(objectid, rx, ry, rz);
}
return 1;
}- A3D_GetSurfaceRotation: Find the rotation that stands an object on a surface, such as a crate on a slope.
- A3D_GetOffsetRotation: Find the rotation in the world of something turned relative to an object, such as an object attached to another.
3DAndreas 0.7.1 · Repository · Releases · MIT License
Guides
- Installation
- Configuration
- Physics objects
- Model settings
- World queries
- The screen
- Routes
- Navigation mesh
- Map database
- Coming from ColAndreas
- Performance
Reference
Functions