Heading & distance
GTA headings run counter-clockwise (0 north, 90 west), compass bearings run clockwise. Convert between them, measure distance, find the heading from one coordinate to another and project a point along a heading.
Convention used
- Axes: +x east, +y north, +z up. GTA heading (what
GetEntityHeadingreturns) is 0 to 360 with 0 = north and it increases counter-clockwise: 0 N, 90 W, 180 S, 270 E. - Compass bearing is clockwise from north: bearing = (360 − heading) mod 360. The same formula converts back.
- Heading from A to B: heading = normalise(atan2(−dx, dy)) in degrees, with dx = B.x − A.x and dy = B.y − A.y. Moving distance d along heading h: x′ = x − sin(h)·d, y′ = y + cos(h)·d; z is unchanged unless you add a height change.
Convert an angle
- GTA heading
- 90°
- Compass bearing
- 270°
- Heading (radians)
- 1.5708
- Bearing (radians)
- 4.7124
- Facing (8-point)
- W
- Facing (16-point)
- W
Distance and heading between two points
Accepts vec3/vector3(…), {x = 1, y = 2, z = 3} or plain numbers. Without a z on both points only the 2D values are shown.
- Distance (2D)
- 5
- Distance (3D)
- 13
- Heading A → B
- 323.1301° (NE)
- Bearing A → B
- 36.8699° (NE)
- Heading B → A
- 143.1301°
Move along a heading
- Reached point
- vector3(95, 200, 30)
- x
- 95
- y
- 200
- z
- 30
- Facing
- W (bearing 270°)
Runs entirely in your browser. Nothing you type is sent to us.