> For the complete documentation index, see [llms.txt](https://zloma-scripts.gitbook.io/zloma-scripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zloma-scripts.gitbook.io/zloma-scripts/zloma_garages-paid/features/vehicle-preview.md).

# Vehicle Preview

zloma\_garages features a 3D vehicle preview system that renders the actual vehicle model at the spawn point with camera controls.

***

## How It Works

When a player selects a vehicle in the garage menu:

1. A preview vehicle spawns at the first available spawn point
2. Camera moves to a cinematic view of the vehicle
3. Player can cycle between **side**, **front**, and **back** views
4. Selecting a different vehicle updates the preview in real-time
5. Taking out the vehicle uses the preview spawn point (avoiding double collision checks)

***

## Camera Views

| View      | Description                           |
| --------- | ------------------------------------- |
| **Side**  | Default — shows vehicle from the side |
| **Front** | Shows front of the vehicle            |
| **Back**  | Shows rear of the vehicle             |

Transitions between views use smooth camera movement with optional rotation effect.

***

## Configuration

```lua
Config.VehiclePreview = {
    enabled = true,
    cameraFov = 55.0,
    views = {
        side  = { distance = 6.0, height = 1.2, angle = 15.0 },
        front = { distance = 6.0, height = 1.2, angle = 15.0 },
        back  = { distance = 6.0, height = 1.2, angle = 15.0 }
    },
    transitionDuration = 1500,
    enableRotation = true
}
```

| Option               | Description                                       |
| -------------------- | ------------------------------------------------- |
| `enabled`            | Enable/disable the preview system entirely        |
| `cameraFov`          | Field of view — lower = more zoom, higher = wider |
| `views.*.distance`   | Camera distance from vehicle (meters)             |
| `views.*.height`     | Camera height offset (meters)                     |
| `views.*.angle`      | Camera angle offset (degrees)                     |
| `transitionDuration` | Animation time between views (ms)                 |
| `enableRotation`     | Add rotation effect during transitions            |

***

## Preview Spawn Point

The preview system uses `Config.SpawnPointCheck.TrustPreview` (default: `true`) to skip re-checking collision when the player takes out a vehicle. Since the preview already occupies a spawn point, the system trusts that the point is valid.

If all spawn points are occupied, the preview falls back to offset spawning based on `Config.SpawnFallbackOffset` and `Config.SpawnFallbackMaxAttempts`.

***

## Disabling Preview

Set `Config.VehiclePreview.enabled = false` to disable the preview system. Vehicles will spawn without preview when taken out, and the garage UI will show vehicle information without a 3D model.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://zloma-scripts.gitbook.io/zloma-scripts/zloma_garages-paid/features/vehicle-preview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
