# trace

## Functions:

### ray

`trace.ray(vec_start: vector, vec_end: vector, skip_entity: entity, mask: number):` <mark style="color:purple;">`trace`</mark>

| Name             | Type         | Description                  |
| ---------------- | ------------ | ---------------------------- |
| **vec\_start**   | **`vector`** | Vector to start tracing from |
| **vec\_end**     | **`vector`** | Vector to trace to           |
| **skip\_entity** | **`entity`** | Entity skipping options      |
| **mask**         | **`number`** | Trace mask                   |

```lua
local trace_example = trace.ray(vector(0,0,0), vector(100, 100, 100), entity.get_local(), 0xFFFFFFFF)
local trace_fraction = trace_example.fraction
```

Returns a [`trace`](#struct-trace) struct containing all the information.

#### 🔗 struct <mark style="color:blue;">`trace`</mark>

<table><thead><tr><th width="190">Name</th><th width="202">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>fraction</strong></td><td><strong><code>number</code></strong></td><td>Percentage in the range [0.0, 1.0]. How far the trace went before hitting something. <mark style="color:blue;"><code>1.0</code></mark> - didn't hit anything</td></tr><tr><td><strong>hit_entity</strong></td><td><strong><code>entity</code></strong></td><td>Entity that was hit by the trace</td></tr><tr><td><strong>hitgroup</strong></td><td><strong><code>number</code></strong></td><td><mark style="color:blue;"><code>0</code></mark> - generic, non-zero is specific body part</td></tr><tr><td><strong>endpos</strong></td><td><strong><code>vector</code></strong></td><td>Final position</td></tr></tbody></table>
