UZ Scripts
Garage

Camera System

Configure the orbit camera preview with rotation, vertical movement, and zoom controls.

The garage uses an orbit camera that automatically positions itself around the vehicle. Players can interact with the preview using mouse controls.


Controls

InputAction
Mouse Drag (horizontal)Rotate camera around the vehicle
Mouse Drag (vertical)Raise or lower camera height
Scroll WheelZoom in / out (radius)
ESCReturn to vehicle list

Camera Config

Each garage has a Camera table. Only vehSpawn is required — all other values are optional with sensible defaults.

Prop

Type


Examples

Minimal (auto-calculated)

Camera = {
    vehSpawn = vec4(422.81, -1023.23, 27.94, 93.18),
    fov = 35.0,
},

The camera will start at heading + 210 degrees, 8 meters away, 2 meters high.

Fully Customized

Camera = {
    vehSpawn = vec4(422.81, -1023.23, 27.94, 93.18),
    fov = 40.0,
    angle = 180.0,       -- start directly behind the vehicle
    radius = 6.0,        -- closer starting distance
    height = 1.5,        -- lower camera
    minRadius = 2.0,     -- allow very close zoom
    maxRadius = 10.0,    -- limit max zoom out
    minHeight = 0.3,     -- allow almost ground level
    maxHeight = 5.0,     -- limit max height
},

Tight Indoor Garage

Camera = {
    vehSpawn = vec4(-1166.14, -749.47, 19.26, 265.17),
    fov = 50.0,
    radius = 5.0,
    height = 1.5,
    minRadius = 2.5,
    maxRadius = 7.0,
    maxHeight = 3.0,
},

How It Works

The camera calculates its position using polar coordinates:

camX = center.x + radius * cos(angle)
camY = center.y + radius * sin(angle)
camZ = center.z + height

The camera always points at the vehicle center (0.5m above ground). The vehicle is frozen in place (FreezeEntityPosition) during preview — the camera moves, not the vehicle.

Migration from v2.x: The old locationPos and locationRot fields are no longer used. Only vehSpawn and fov are needed — the camera position is calculated automatically.

On this page