> Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

---
title: Trace
icon: squares-intersect
---

# <ApiPageIcon icon="squares-intersect" />Trace

<ApiExposes data="[{&#x22;k&#x22;:&#x22;NAMESPACE&#x22;,&#x22;c&#x22;:&#x22;fn&#x22;,&#x22;s&#x22;:&#x22;trace&#x22;,&#x22;h&#x22;:&#x22;#trace-1&#x22;},{&#x22;k&#x22;:&#x22;OBJECT&#x22;,&#x22;c&#x22;:&#x22;method&#x22;,&#x22;s&#x22;:&#x22;trace.Trace&#x22;,&#x22;h&#x22;:&#x22;#tracetrace&#x22;},{&#x22;k&#x22;:&#x22;OBJECT&#x22;,&#x22;c&#x22;:&#x22;method&#x22;,&#x22;s&#x22;:&#x22;trace.Filter&#x22;,&#x22;h&#x22;:&#x22;#tracefilter&#x22;}]" />

<Heading level={2} id="trace-1">
  trace

  <ApiTag label="global table" />
</Heading>

Traces rays and shapes through the world and returns what they hit.

<ApiMembers>
  <ApiMember kind="fn" name="trace.Filter" summary="Creates a trace filter. You can give entities that the trace skips, and the layers, collision group and object types that the trace uses." args="ignore_entities?, interacts_with?, collision_group?, object_set?" sig="[{&#x22;s&#x22;:&#x22;trace.Filter&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;[&#x22;},{&#x22;s&#x22;:&#x22;ignore_entities&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;client.C_BaseEntity&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/dumped_data/schema/client/C_BaseEntity&#x22;},{&#x22;s&#x22;:&#x22;|&#x22;},{&#x22;s&#x22;:&#x22;client.C_BaseEntity&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/dumped_data/schema/client/C_BaseEntity&#x22;},{&#x22;s&#x22;:&#x22;[&#x22;},{&#x22;s&#x22;:&#x22;]&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;interacts_with&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;uint64_t&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#uint64_t&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;collision_group&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;integer&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#integer&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;object_set&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;integer&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#integer&#x22;},{&#x22;s&#x22;:&#x22;]&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;trace.Filter&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracefilter&#x22;}]" ret="[[{&#x22;s&#x22;:&#x22;trace.Filter&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracefilter&#x22;}]]" params="[{&#x22;n&#x22;:&#x22;ignore_entities&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;client.C_BaseEntity&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/dumped_data/schema/client/C_BaseEntity&#x22;},{&#x22;s&#x22;:&#x22;|&#x22;},{&#x22;s&#x22;:&#x22;client.C_BaseEntity&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/dumped_data/schema/client/C_BaseEntity&#x22;},{&#x22;s&#x22;:&#x22;[&#x22;},{&#x22;s&#x22;:&#x22;]&#x22;}],&#x22;d&#x22;:&#x22;The entities that the trace skips.&#x22;,&#x22;o&#x22;:true},{&#x22;n&#x22;:&#x22;interacts_with&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;uint64_t&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#uint64_t&#x22;}],&#x22;d&#x22;:&#x22;A bit mask of `trace.CONTENTS` layers that the trace hits. The default is the mask used for bullets, which is `SOLID`, `HITBOX`, `SKY`, `WINDOW`, `GRATE`, `PLAYER`, `NPC` and `DEBRIS`.&#x22;,&#x22;o&#x22;:true},{&#x22;n&#x22;:&#x22;collision_group&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;integer&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#integer&#x22;}],&#x22;d&#x22;:&#x22;The collision group of the trace. See `trace.BuiltInCollisionGroup_t` and `trace.StandardCollisionGroups_t`. The default is `CONDITIONALLY_SOLID`.&#x22;,&#x22;o&#x22;:true},{&#x22;n&#x22;:&#x22;object_set&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;integer&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#integer&#x22;}],&#x22;d&#x22;:&#x22;A bit mask of `trace.RnQueryObjectSet` object types that the trace checks. The default is `ALL`.&#x22;,&#x22;o&#x22;:true}]" nodiscard>
    <ApiNotes>
      To skip entities, pass one entity or a table of entities. Up to two entities are fast. Each
      entity after the second makes traces slower.
    </ApiNotes>
  </ApiMember>

  <ApiMember kind="fn" name="trace.Filter" summary="Creates a trace filter from a table of settings. The keys of the table are the writable fields of `trace.Filter`." id="trace-Filter-2" args="params" sig="[{&#x22;s&#x22;:&#x22;trace.Filter&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;params&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;table&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/table#table-1&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;trace.Filter&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracefilter&#x22;}]" ret="[[{&#x22;s&#x22;:&#x22;trace.Filter&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracefilter&#x22;}]]" params="[{&#x22;n&#x22;:&#x22;params&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;table&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/table#table-1&#x22;}],&#x22;d&#x22;:&#x22;The filter settings, with field names as keys.&#x22;}]" nodiscard>
    <ApiNotes>
      Fields that you do not set keep the values of an empty filter. In an empty filter,
      `interacts_with` is `0`, so the trace hits nothing. `collision_group` is `CONDITIONALLY_SOLID`
      and `object_set_mask` is `ALL`.
    </ApiNotes>
  </ApiMember>

  <ApiMember kind="fn" name="trace.Ray" summary="Traces a ray, which is a single point, from `startpos` to `endpos`." args="startpos, endpos, filter" sig="[{&#x22;s&#x22;:&#x22;trace.Ray&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;startpos&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;endpos&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;filter&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;trace.Filter&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracefilter&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;trace.Trace&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracetrace&#x22;}]" ret="[[{&#x22;s&#x22;:&#x22;trace.Trace&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracetrace&#x22;}]]" params="[{&#x22;n&#x22;:&#x22;startpos&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;The start position of the ray.&#x22;},{&#x22;n&#x22;:&#x22;endpos&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;The end position of the ray.&#x22;},{&#x22;n&#x22;:&#x22;filter&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;trace.Filter&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracefilter&#x22;}],&#x22;d&#x22;:&#x22;The filter that decides which objects and layers the trace hits.&#x22;}]" nodiscard />

  <ApiMember kind="fn" name="trace.Sphere" summary="Moves a sphere from `startpos` to `endpos` and returns what it hits." args="startpos, endpos, radius, filter" sig="[{&#x22;s&#x22;:&#x22;trace.Sphere&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;startpos&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;endpos&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;radius&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;number&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#number&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;filter&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;trace.Filter&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracefilter&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;trace.Trace&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracetrace&#x22;}]" ret="[[{&#x22;s&#x22;:&#x22;trace.Trace&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracetrace&#x22;}]]" params="[{&#x22;n&#x22;:&#x22;startpos&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;The start position of the center of the sphere.&#x22;},{&#x22;n&#x22;:&#x22;endpos&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;The end position of the center of the sphere.&#x22;},{&#x22;n&#x22;:&#x22;radius&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;number&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#number&#x22;}],&#x22;d&#x22;:&#x22;The radius of the sphere in units.&#x22;},{&#x22;n&#x22;:&#x22;filter&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;trace.Filter&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracefilter&#x22;}],&#x22;d&#x22;:&#x22;The filter that decides which objects and layers the trace hits.&#x22;}]" nodiscard />

  <ApiMember kind="fn" name="trace.Capsule" summary="Moves a capsule from `startpos` to `endpos` and returns what it hits. The end points of the capsule are relative to the position of the moving capsule." args="startpos, endpos, p1, p2, radius, filter" sig="[{&#x22;s&#x22;:&#x22;trace.Capsule&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;startpos&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;endpos&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;p1&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;p2&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;radius&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;number&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#number&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;filter&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;trace.Filter&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracefilter&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;trace.Trace&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracetrace&#x22;}]" ret="[[{&#x22;s&#x22;:&#x22;trace.Trace&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracetrace&#x22;}]]" params="[{&#x22;n&#x22;:&#x22;startpos&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;The start position of the trace.&#x22;},{&#x22;n&#x22;:&#x22;endpos&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;The end position of the trace.&#x22;},{&#x22;n&#x22;:&#x22;p1&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;The first end point of the line segment inside the capsule.&#x22;},{&#x22;n&#x22;:&#x22;p2&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;The second end point of the line segment inside the capsule.&#x22;},{&#x22;n&#x22;:&#x22;radius&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;number&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#number&#x22;}],&#x22;d&#x22;:&#x22;The radius of the capsule in units.&#x22;},{&#x22;n&#x22;:&#x22;filter&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;trace.Filter&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracefilter&#x22;}],&#x22;d&#x22;:&#x22;The filter that decides which objects and layers the trace hits.&#x22;}]" nodiscard />

  <ApiMember kind="fn" name="trace.AABB" summary="Moves an axis aligned box from `startpos` to `endpos` and returns what it hits. The corners of the box are relative to the position of the moving box." args="startpos, endpos, mins, maxs, filter" sig="[{&#x22;s&#x22;:&#x22;trace.AABB&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;startpos&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;endpos&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;mins&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;maxs&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;filter&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;trace.Filter&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracefilter&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;trace.Trace&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracetrace&#x22;}]" ret="[[{&#x22;s&#x22;:&#x22;trace.Trace&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracetrace&#x22;}]]" params="[{&#x22;n&#x22;:&#x22;startpos&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;The start position of the origin of the box.&#x22;},{&#x22;n&#x22;:&#x22;endpos&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;The end position of the origin of the box.&#x22;},{&#x22;n&#x22;:&#x22;mins&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;The minimum corner of the box, relative to the origin.&#x22;},{&#x22;n&#x22;:&#x22;maxs&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;The maximum corner of the box, relative to the origin.&#x22;},{&#x22;n&#x22;:&#x22;filter&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;trace.Filter&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracefilter&#x22;}],&#x22;d&#x22;:&#x22;The filter that decides which objects and layers the trace hits.&#x22;}]" nodiscard />

  <ApiMember kind="fn" name="trace.ConvexHull" summary="Moves a convex hull from `startpos` to `endpos` and returns what it hits. The vertices are relative to the position of the moving hull." args="startpos, endpos, verts, filter" sig="[{&#x22;s&#x22;:&#x22;trace.ConvexHull&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;startpos&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;endpos&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;verts&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;[&#x22;},{&#x22;s&#x22;:&#x22;]&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;filter&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;trace.Filter&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracefilter&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;trace.Trace&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracetrace&#x22;}]" ret="[[{&#x22;s&#x22;:&#x22;trace.Trace&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracetrace&#x22;}]]" params="[{&#x22;n&#x22;:&#x22;startpos&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;The start position of the origin of the hull.&#x22;},{&#x22;n&#x22;:&#x22;endpos&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;The end position of the origin of the hull.&#x22;},{&#x22;n&#x22;:&#x22;verts&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;[&#x22;},{&#x22;s&#x22;:&#x22;]&#x22;}],&#x22;d&#x22;:&#x22;A table of points that are the vertices of the convex hull.&#x22;},{&#x22;n&#x22;:&#x22;filter&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;trace.Filter&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracefilter&#x22;}],&#x22;d&#x22;:&#x22;The filter that decides which objects and layers the trace hits.&#x22;}]" nodiscard />

  <ApiMember kind="fn" name="trace.Bullet" summary="Simulates a bullet and calculates its damage through surfaces and penetration. This function does not fire a shot." args="startpos, endpos, attacker, vdata?, filter?" sig="[{&#x22;s&#x22;:&#x22;trace.Bullet&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;startpos&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;endpos&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;attacker&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;client.C_CSPlayerPawn&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/dumped_data/schema/client/C_CSPlayerPawn&#x22;},{&#x22;s&#x22;:&#x22;[, &#x22;},{&#x22;s&#x22;:&#x22;vdata&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;client.CCSWeaponBaseVData&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/dumped_data/schema/client/CCSWeaponBaseVData&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;filter&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;trace.Filter&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracefilter&#x22;},{&#x22;s&#x22;:&#x22;]&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;trace.Trace&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracetrace&#x22;}]" ret="[[{&#x22;s&#x22;:&#x22;trace.Trace&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracetrace&#x22;}]]" params="[{&#x22;n&#x22;:&#x22;startpos&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;The start position of the bullet.&#x22;},{&#x22;n&#x22;:&#x22;endpos&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;A position that sets the direction of the bullet.&#x22;},{&#x22;n&#x22;:&#x22;attacker&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;client.C_CSPlayerPawn&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/dumped_data/schema/client/C_CSPlayerPawn&#x22;}],&#x22;d&#x22;:&#x22;The player pawn that shoots the bullet.&#x22;},{&#x22;n&#x22;:&#x22;vdata&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;client.CCSWeaponBaseVData&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/dumped_data/schema/client/CCSWeaponBaseVData&#x22;}],&#x22;d&#x22;:&#x22;The weapon data for penetration and damage falloff. Pass nil to use the data of the active weapon of the attacker.&#x22;,&#x22;o&#x22;:true},{&#x22;n&#x22;:&#x22;filter&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;trace.Filter&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracefilter&#x22;}],&#x22;d&#x22;:&#x22;The filter that sets which objects and layers the bullet can hit. Pass nil to use a filter that ignores the attacker.&#x22;,&#x22;o&#x22;:true}]" returns="[{&#x22;n&#x22;:&#x22;...&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;trace.Trace&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/trace#tracetrace&#x22;}],&#x22;d&#x22;:&#x22;One value for each impact. Returns no values if there are no impacts.&#x22;}]">
    <ApiNotes>
      The bullet starts at `startpos` and moves in the direction of `endpos`. It travels the full
      range of the weapon, so it can go past `endpos`. It can penetrate up to 4 surfaces.

      Returns one value for each impact, starting with the first impact. Use `{trace.Bullet(...)}`
      to put the values in a table. Throws an error if there is no weapon data.
    </ApiNotes>
  </ApiMember>

  <ApiMember kind="fn" name="trace.IntersectCapsule" summary="Tests whether the segment from `startpos` to `endpos` hits a capsule in world space." args="startpos, endpos, p1, p2, radius" sig="[{&#x22;s&#x22;:&#x22;trace.IntersectCapsule&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;startpos&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;endpos&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;p1&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;p2&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;radius&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;number&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#number&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;number&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#number&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}]" ret="[[{&#x22;s&#x22;:&#x22;number&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#number&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}],[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}]]" params="[{&#x22;n&#x22;:&#x22;startpos&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;The start of the segment.&#x22;},{&#x22;n&#x22;:&#x22;endpos&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;The end of the segment.&#x22;},{&#x22;n&#x22;:&#x22;p1&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;The center of the first end of the capsule in world space.&#x22;},{&#x22;n&#x22;:&#x22;p2&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;The center of the second end of the capsule in world space.&#x22;},{&#x22;n&#x22;:&#x22;radius&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;number&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#number&#x22;}],&#x22;d&#x22;:&#x22;The radius of the capsule.&#x22;}]" returns="[{&#x22;n&#x22;:&#x22;fraction&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;number&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#number&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}],&#x22;d&#x22;:&#x22;The position of the first contact on the segment, from 0 to 1.&#x22;},{&#x22;n&#x22;:&#x22;hitpos&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}],&#x22;d&#x22;:&#x22;The first contact point.&#x22;}]" nodiscard>
    <ApiNotes>
      This function only does math on the shape. It does not check the world, so it works for
      shapes that do not exist in the game, at any position and rotation. To rotate a capsule,
      transform the centers of its ends, for example with
      `CTransform(origin, rotation):TransformVector(Vector(0, 0, 8))`.

      Returns **nil** if the segment does not hit the capsule. A fraction of 0 means that `startpos`
      is already inside the capsule.

      You can pass the capsule of a hitbox directly, for example
      `trace.IntersectCapsule(startpos, endpos, hitbox:GetCapsule())`.

      World geometry is ignored. To check whether a bullet reaches the shape, compare the fraction
      with the result of `trace.Ray` or `trace.Bullet` for the same segment.
    </ApiNotes>
  </ApiMember>

  <ApiMember kind="fn" name="trace.IntersectSphere" summary="Tests whether the segment from `startpos` to `endpos` hits a sphere in world space. In the same way as `trace.IntersectCapsule`, this function only does math on the shape and does not check the world." args="startpos, endpos, center, radius" sig="[{&#x22;s&#x22;:&#x22;trace.IntersectSphere&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;startpos&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;endpos&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;center&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;radius&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;number&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#number&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;number&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#number&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}]" ret="[[{&#x22;s&#x22;:&#x22;number&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#number&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}],[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}]]" params="[{&#x22;n&#x22;:&#x22;startpos&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;The start of the segment.&#x22;},{&#x22;n&#x22;:&#x22;endpos&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;The end of the segment.&#x22;},{&#x22;n&#x22;:&#x22;center&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}],&#x22;d&#x22;:&#x22;The center of the sphere in world space.&#x22;},{&#x22;n&#x22;:&#x22;radius&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;number&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#number&#x22;}],&#x22;d&#x22;:&#x22;The radius of the sphere.&#x22;}]" returns="[{&#x22;n&#x22;:&#x22;fraction&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;number&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#number&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}],&#x22;d&#x22;:&#x22;The position of the first contact on the segment, from 0 to 1.&#x22;},{&#x22;n&#x22;:&#x22;hitpos&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}],&#x22;d&#x22;:&#x22;The first contact point.&#x22;}]" nodiscard>
    <ApiNotes>
      Returns **nil** if the segment does not hit the sphere. A fraction of 0 means that `startpos`
      is already inside the sphere.
    </ApiNotes>
  </ApiMember>

  <ApiMember kind="type" name="trace.CONTENTS" summary="The interaction layer bits for the `interacts_with`, `interacts_as` and `interacts_exclude` fields of a trace filter. Use `bit.bor` to combine bits, or use a predefined `trace.MASK`." ret="[[{&#x22;s&#x22;:&#x22;integer&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#integer&#x22;}]]">
    <ApiEnum name="trace.CONTENTS" values="[[&#x22;TEAM1&#x22;,&#x22;2147483648&#x22;,&#x22;Geometry for team 1 only&#x22;],[&#x22;TEAM2&#x22;,&#x22;4294967296&#x22;,&#x22;Geometry for team 2 only&#x22;],[&#x22;GRENADECLIP&#x22;,&#x22;8589934592&#x22;,&#x22;Invisible barriers that block grenade movement&#x22;],[&#x22;DRONECLIP&#x22;,&#x22;17179869184&#x22;,&#x22;Invisible barriers that block drone movement&#x22;],[&#x22;MOVEABLE&#x22;,&#x22;34359738368&#x22;,&#x22;Moveable physics objects&#x22;],[&#x22;OPAQUE&#x22;,&#x22;68719476736&#x22;,&#x22;Opaque surfaces that block visibility&#x22;],[&#x22;MONSTER&#x22;,&#x22;137438953472&#x22;,&#x22;Collision bodies of monsters and bots&#x22;],[&#x22;CHICKEN&#x22;,&#x22;274877906944&#x22;,&#x22;Collision bodies of chickens&#x22;],[&#x22;THROWN_GRENADE&#x22;,&#x22;549755813888&#x22;,&#x22;Thrown grenades in flight&#x22;],[&#x22;DROPPED_HOSTAGE&#x22;,&#x22;1099511627776&#x22;,&#x22;Collision bodies of dropped hostages&#x22;],[&#x22;EMPTY&#x22;,&#x22;0&#x22;,&#x22;No contents&#x22;],[&#x22;SOLID&#x22;,&#x22;1&#x22;,&#x22;Solid world geometry&#x22;],[&#x22;HITBOX&#x22;,&#x22;2&#x22;,&#x22;Player and entity hitboxes&#x22;],[&#x22;TRIGGER&#x22;,&#x22;4&#x22;,&#x22;Trigger volumes&#x22;],[&#x22;SKY&#x22;,&#x22;8&#x22;,&#x22;Sky geometry&#x22;],[&#x22;PLAYER_CLIP&#x22;,&#x22;16&#x22;,&#x22;Player movement clip brushes&#x22;],[&#x22;NPC_CLIP&#x22;,&#x22;32&#x22;,&#x22;NPC movement clip brushes&#x22;],[&#x22;BLOCK_LOS&#x22;,&#x22;64&#x22;,&#x22;Line-of-sight blockers&#x22;],[&#x22;BLOCK_LIGHT&#x22;,&#x22;128&#x22;,&#x22;Light blockers&#x22;],[&#x22;LADDER&#x22;,&#x22;256&#x22;,&#x22;Climbable ladder surfaces&#x22;],[&#x22;PICKUP&#x22;,&#x22;512&#x22;,&#x22;Item pickup volumes&#x22;],[&#x22;BLOCK_SOUND&#x22;,&#x22;1024&#x22;,&#x22;Sound propagation blockers&#x22;],[&#x22;NODRAW&#x22;,&#x22;2048&#x22;,&#x22;Non-rendered surfaces&#x22;],[&#x22;WINDOW&#x22;,&#x22;4096&#x22;,&#x22;Breakable glass windows&#x22;],[&#x22;GRATE&#x22;,&#x22;8192&#x22;,&#x22;Grates and bars&#x22;],[&#x22;WORLD_GEOMETRY&#x22;,&#x22;16384&#x22;,&#x22;Standard world brush geometry&#x22;],[&#x22;WATER&#x22;,&#x22;32768&#x22;,&#x22;Water volumes&#x22;],[&#x22;SLIME&#x22;,&#x22;65536&#x22;,&#x22;Slime and toxic liquid volumes&#x22;],[&#x22;TOUCH_TRIGGERS&#x22;,&#x22;131072&#x22;,&#x22;Touch-only trigger volumes&#x22;],[&#x22;PLAYER&#x22;,&#x22;262144&#x22;,&#x22;Player collision bodies&#x22;],[&#x22;NPC&#x22;,&#x22;524288&#x22;,&#x22;NPC collision bodies&#x22;],[&#x22;DEBRIS&#x22;,&#x22;1048576&#x22;,&#x22;Debris and gibs&#x22;],[&#x22;PHYSICS_PROP&#x22;,&#x22;2097152&#x22;,&#x22;Physics prop bodies&#x22;],[&#x22;NAV_IGNORE&#x22;,&#x22;4194304&#x22;,&#x22;Ignored by nav mesh generation&#x22;],[&#x22;NAV_LOCAL_IGNORE&#x22;,&#x22;8388608&#x22;,&#x22;Locally ignored by nav mesh generation&#x22;],[&#x22;POSTPROCESSING_VOLUME&#x22;,&#x22;16777216&#x22;,&#x22;Post-processing effect volumes&#x22;],[&#x22;UNUSED3&#x22;,&#x22;33554432&#x22;,&#x22;Unused&#x22;],[&#x22;CARRIED_OBJECT&#x22;,&#x22;67108864&#x22;,&#x22;Objects currently being carried by a player&#x22;],[&#x22;PUSHAWAY&#x22;,&#x22;134217728&#x22;,&#x22;Objects that push players away on contact&#x22;],[&#x22;SERVER_ENTITY_ON_CLIENT&#x22;,&#x22;268435456&#x22;,&#x22;Server-side entity replicated to the client&#x22;],[&#x22;CARRIED_WEAPON&#x22;,&#x22;536870912&#x22;,&#x22;Weapons currently carried by a player&#x22;],[&#x22;STATIC_LEVEL&#x22;,&#x22;1073741824&#x22;,&#x22;Static level geometry&#x22;]]" />
  </ApiMember>

  <ApiMember kind="type" name="trace.MASK" summary="Predefined combinations of `trace.CONTENTS` bits for common traces." ret="[[{&#x22;s&#x22;:&#x22;integer&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#integer&#x22;}]]">
    <ApiEnum name="trace.MASK" values="[[&#x22;PLAYERSOLID_BRUSHONLY&#x22;,&#x22;34359750673&#x22;,&#x22;Brush geometry that is solid for players, including team geometry&#x22;],[&#x22;FLOORTRACE&#x22;,&#x22;34360791041&#x22;,&#x22;Finds floor surfaces that players can walk on&#x22;],[&#x22;VISIBLE&#x22;,&#x22;1&#x22;,&#x22;Visible solid geometry only&#x22;],[&#x22;BLOCKLOS&#x22;,&#x22;66&#x22;,&#x22;Surfaces that block line of sight&#x22;],[&#x22;OPAQUE&#x22;,&#x22;128&#x22;,&#x22;Surfaces that block light&#x22;],[&#x22;NPCWORLDSTATIC_FLUID&#x22;,&#x22;4129&#x22;,&#x22;NPC world static geometry including fluid&#x22;],[&#x22;SOLID_BRUSHONLY&#x22;,&#x22;12289&#x22;,&#x22;Solid brush geometry only, no entities&#x22;],[&#x22;DEFAULTPLAYERSOLID_BRUSHONLY&#x22;,&#x22;12305&#x22;,&#x22;Default player-solid brush geometry only&#x22;],[&#x22;NPCWORLDSTATIC&#x22;,&#x22;12321&#x22;,&#x22;NPC world static geometry&#x22;],[&#x22;NPCSOLID_BRUSHONLY&#x22;,&#x22;12321&#x22;,&#x22;NPC-solid brush geometry only&#x22;],[&#x22;WATER&#x22;,&#x22;98304&#x22;,&#x22;Water and slime volumes&#x22;],[&#x22;VISIBLE_AND_NPCS&#x22;,&#x22;524289&#x22;,&#x22;Visible geometry and NPC bodies&#x22;],[&#x22;BLOCKLOS_AND_NPCS&#x22;,&#x22;524354&#x22;,&#x22;Line-of-sight blockers and NPC bodies&#x22;],[&#x22;OPAQUE_AND_NPCS&#x22;,&#x22;524416&#x22;,&#x22;Opaque surfaces and NPC bodies&#x22;],[&#x22;SOLID&#x22;,&#x22;798721&#x22;,&#x22;All solid surfaces including players and NPCs&#x22;],[&#x22;DEFAULTPLAYERSOLID&#x22;,&#x22;798737&#x22;,&#x22;Default solid mask for player movement&#x22;],[&#x22;NPCSOLID&#x22;,&#x22;798753&#x22;,&#x22;Default solid mask for NPC movement&#x22;],[&#x22;SHOT_BRUSHONLY&#x22;,&#x22;1052673&#x22;,&#x22;Brush surfaces only for bullet traces&#x22;],[&#x22;SHOT&#x22;,&#x22;1839107&#x22;,&#x22;Full bullet trace mask including players, NPCs, and debris&#x22;],[&#x22;SHOT_HULL&#x22;,&#x22;1847297&#x22;,&#x22;Hull-based shot mask for grenades and larger projectiles&#x22;],[&#x22;ALL&#x22;,&#x22;0xFFFFFFFFFFFFFFFF&#x22;,&#x22;All layers&#x22;]]" />
  </ApiMember>

  <ApiMember kind="type" name="trace.RnQueryObjectSet" summary="The object types that a trace checks. Use them for the `object_set` argument of `trace.Filter` and for the `object_set_mask` field of a filter. Use `bit.bor` to combine bits." ret="[[{&#x22;s&#x22;:&#x22;integer&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#integer&#x22;}]]">
    <ApiEnum name="trace.RnQueryObjectSet" values="[[&#x22;STATIC&#x22;,&#x22;1&#x22;,&#x22;Static world geometry&#x22;],[&#x22;KEYFRAMED&#x22;,&#x22;2&#x22;,&#x22;Keyframed bodies, which are animated&#x22;],[&#x22;DYNAMIC&#x22;,&#x22;4&#x22;,&#x22;Dynamic physics bodies&#x22;],[&#x22;LOCATABLE&#x22;,&#x22;8&#x22;,&#x22;Locatable bodies&#x22;],[&#x22;ALL_GAME_ENTITIES&#x22;,&#x22;14&#x22;,&#x22;Every entity body, which means keyframed, dynamic and locatable bodies&#x22;],[&#x22;ALL&#x22;,&#x22;15&#x22;,&#x22;Static geometry and every entity body&#x22;],[&#x22;KEYFRAMED_ONLY&#x22;,&#x22;2&#x22;,&#x22;Keyframed bodies only&#x22;],[&#x22;DYNAMIC_ONLY&#x22;,&#x22;4&#x22;,&#x22;Dynamic bodies only&#x22;]]" />

    <ApiNotes>
      <Note>
        The members and their values depend on the game build. `STATIC`, `DYNAMIC`,
        `ALL_GAME_ENTITIES`, `ALL`, `KEYFRAMED_ONLY` and `DYNAMIC_ONLY` exist in every build.
      </Note>
    </ApiNotes>
  </ApiMember>

  <ApiMember kind="type" name="trace.BuiltInCollisionGroup_t" summary="The collision groups that the engine defines for every game. Use them for the `collision_group` argument of `trace.Filter` and for the `collision_group` field of a filter." ret="[[{&#x22;s&#x22;:&#x22;integer&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#integer&#x22;}]]">
    <ApiEnum name="trace.BuiltInCollisionGroup_t" values="[[&#x22;ALWAYS&#x22;,&#x22;0&#x22;,&#x22;Collides with everything&#x22;],[&#x22;NONPHYSICAL&#x22;,&#x22;1&#x22;,&#x22;Non-physical objects&#x22;],[&#x22;TRIGGER&#x22;,&#x22;2&#x22;,&#x22;Trigger volumes&#x22;],[&#x22;CONDITIONALLY_SOLID&#x22;,&#x22;3&#x22;,&#x22;Solid depending on the other object. This is the default group of a trace&#x22;],[&#x22;FIRST_USER&#x22;,&#x22;4&#x22;,&#x22;First group a game may define&#x22;],[&#x22;COLLISION_GROUPS_MAX_ALLOWED&#x22;,&#x22;64&#x22;,&#x22;Number of group slots&#x22;]]" />
  </ApiMember>

  <ApiMember kind="type" name="trace.StandardCollisionGroups_t" summary="The collision groups that Source 2 games share. Their values start at the value of `BuiltInCollisionGroup_t.FIRST_USER`." ret="[[{&#x22;s&#x22;:&#x22;integer&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#integer&#x22;}]]">
    <ApiEnum name="trace.StandardCollisionGroups_t" values="[[&#x22;DEFAULT&#x22;,&#x22;4&#x22;,&#x22;Default entity collision&#x22;],[&#x22;DEBRIS&#x22;,&#x22;5&#x22;,&#x22;Debris that collides with the world only&#x22;],[&#x22;INTERACTIVE_DEBRIS&#x22;,&#x22;6&#x22;,&#x22;Debris that also collides with players&#x22;],[&#x22;INTERACTIVE&#x22;,&#x22;7&#x22;,&#x22;Interactive entities&#x22;],[&#x22;PLAYER&#x22;,&#x22;8&#x22;,&#x22;Player bodies&#x22;],[&#x22;BREAKABLE_GLASS&#x22;,&#x22;9&#x22;,&#x22;Breakable glass&#x22;],[&#x22;VEHICLE&#x22;,&#x22;10&#x22;,&#x22;Vehicles&#x22;],[&#x22;PLAYER_MOVEMENT&#x22;,&#x22;11&#x22;,&#x22;Player movement traces&#x22;],[&#x22;NPC&#x22;,&#x22;12&#x22;,&#x22;NPC bodies&#x22;],[&#x22;IN_VEHICLE&#x22;,&#x22;13&#x22;,&#x22;Players inside vehicles&#x22;],[&#x22;WEAPON&#x22;,&#x22;14&#x22;,&#x22;Weapons&#x22;],[&#x22;VEHICLE_CLIP&#x22;,&#x22;15&#x22;,&#x22;Vehicle clip brushes&#x22;],[&#x22;PROJECTILE&#x22;,&#x22;16&#x22;,&#x22;Projectiles&#x22;],[&#x22;DOOR_BLOCKER&#x22;,&#x22;17&#x22;,&#x22;Door blockers&#x22;],[&#x22;PASSABLE_DOOR&#x22;,&#x22;18&#x22;,&#x22;Doors players can pass through&#x22;],[&#x22;DISSOLVING&#x22;,&#x22;19&#x22;,&#x22;Dissolving entities&#x22;],[&#x22;PUSHAWAY&#x22;,&#x22;20&#x22;,&#x22;Objects that push players away&#x22;],[&#x22;NPC_ACTOR&#x22;,&#x22;21&#x22;,&#x22;NPC actors&#x22;],[&#x22;NPC_SCRIPTED&#x22;,&#x22;22&#x22;,&#x22;Scripted NPCs&#x22;],[&#x22;PZ_CLIP&#x22;,&#x22;23&#x22;,&#x22;PZ clip brushes&#x22;],[&#x22;PROPS&#x22;,&#x22;24&#x22;,&#x22;Props&#x22;],[&#x22;LAST_SHARED_COLLISION_GROUP&#x22;,&#x22;25&#x22;,&#x22;First group specific to a game&#x22;]]" />
  </ApiMember>
</ApiMembers>

## trace.Trace<ApiTag label="object type" />

The result of a trace. All trace functions return it. It describes what the trace hit and
where. All fields are read-only.

<ApiMembers>
  <ApiMember kind="prop" name="trace.Trace.attributes" summary="The collision attributes of the shape that was hit." ret="[[{&#x22;s&#x22;:&#x22;userdata&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#userdata&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Trace.body" summary="The physics body that was hit." ret="[[{&#x22;s&#x22;:&#x22;userdata&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#userdata&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Trace.contents" summary="A bit mask of the interaction layers at the hit point, as `trace.CONTENTS` bits." ret="[[{&#x22;s&#x22;:&#x22;uint64_t&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#uint64_t&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Trace.damage" summary="The damage after the surface and penetration modifiers are applied." ret="[[{&#x22;s&#x22;:&#x22;number&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#number&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Trace.damage_is_valid" summary="True if the damage fields have values." ret="[[{&#x22;s&#x22;:&#x22;boolean&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#boolean&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Trace.damage_unscaled" summary="The damage before any modifiers are applied." ret="[[{&#x22;s&#x22;:&#x22;number&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#number&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Trace.endpos" summary="The position where the trace ended. If something was hit, this is the point of impact. If nothing was hit, this is the end position that you passed." ret="[[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Trace.enthit" summary="The entity that was hit. It is **nil** if only world geometry was hit." ret="[[{&#x22;s&#x22;:&#x22;client.C_BaseEntity&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/dumped_data/schema/client/C_BaseEntity&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Trace.fraction" summary="How far along the trace the hit happened. `0` is the start. `1` means that nothing was hit, or that the hit is at the end." ret="[[{&#x22;s&#x22;:&#x22;number&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#number&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Trace.hitbox" summary="The hitbox that was hit. It is **nil** if the hitbox cannot be found on the entity that was hit." ret="[[{&#x22;s&#x22;:&#x22;Hitbox&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/engine/entity#hitbox&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Trace.hitpos" summary="The exact point of contact on the surface that was hit." ret="[[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Trace.hitpos_is_valid" summary="`true` if the `hitpos` field holds valid data." ret="[[{&#x22;s&#x22;:&#x22;boolean&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#boolean&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Trace.normal" summary="The normal of the surface at the hit point." ret="[[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Trace.offset" summary="The plane constant of the plane that was hit. It is the dot product of the normal and a position on the plane." ret="[[{&#x22;s&#x22;:&#x22;number&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#number&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Trace.physicsbone" summary="The index of the physics bone, for skeletal meshes." ret="[[{&#x22;s&#x22;:&#x22;integer&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#integer&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Trace.shape" summary="The physics shape that was hit." ret="[[{&#x22;s&#x22;:&#x22;userdata&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#userdata&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Trace.startpos" summary="The start position of the trace." ret="[[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Trace.startsolid" summary="`true` if the trace started inside solid geometry." ret="[[{&#x22;s&#x22;:&#x22;boolean&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#boolean&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Trace.surface" summary="The surface properties of the surface that was hit, such as friction and density." ret="[[{&#x22;s&#x22;:&#x22;modellib.CPhysSurfaceProperties&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/dumped_data/schema/modellib/CPhysSurfaceProperties&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Trace.transform" summary="The transform of the shape that was hit." ret="[[{&#x22;s&#x22;:&#x22;CTransform&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/transform#ctransform&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Trace.triangle" summary="The index of the face or triangle on the surface that was hit. It is `-1` if there is no such index." ret="[[{&#x22;s&#x22;:&#x22;integer&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#integer&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Trace.type" summary="The type of shape that was traced. `0` is a ray, `1` is a sphere, `2` is a box, `3` is a capsule and `4` is a hull." ret="[[{&#x22;s&#x22;:&#x22;integer&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#integer&#x22;}]]" />
</ApiMembers>

## trace.Filter<ApiTag label="object type" />

Decides which objects and interaction layers a trace collides with.

`ignore_entities` and `should_hit_entity` are write-only. Reading them throws an error. Writing a
field that does not exist also throws an error.

`ignore_entities` takes a table of entities. Up to two entities are fast. Each entity after the
second makes traces slower. Setting `ignore_entities` again replaces the entities that were set
before.

<ApiMembers>
  <ApiMember kind="prop" name="trace.Filter.collision_group" summary="The collision group of the trace. See `trace.BuiltInCollisionGroup_t` and `trace.StandardCollisionGroups_t`." ret="[[{&#x22;s&#x22;:&#x22;integer&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#integer&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Filter.ignore_entities" summary="Write-only. A table of entities that the trace skips. Up to two entities are fast. Each entity after the second makes traces slower." ret="[[{&#x22;s&#x22;:&#x22;client.C_BaseEntity&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/dumped_data/schema/client/C_BaseEntity&#x22;},{&#x22;s&#x22;:&#x22;[&#x22;},{&#x22;s&#x22;:&#x22;]&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Filter.interacts_as" summary="A bit mask of the layers that the trace itself belongs to. Other objects collide with the trace as these layers." ret="[[{&#x22;s&#x22;:&#x22;uint64_t&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#uint64_t&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Filter.interacts_exclude" summary="A bit mask of the layers that the trace never collides with." ret="[[{&#x22;s&#x22;:&#x22;uint64_t&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#uint64_t&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Filter.interacts_with" summary="A bit mask of the interaction layers that the trace hits." ret="[[{&#x22;s&#x22;:&#x22;uint64_t&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#uint64_t&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Filter.object_set_mask" summary="A bit mask of the `trace.RnQueryObjectSet` object types that the trace checks." ret="[[{&#x22;s&#x22;:&#x22;integer&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#integer&#x22;}]]" />

  <ApiMember kind="prop" name="trace.Filter.should_hit_entity" summary="Write-only. A function that is called for each entity that the trace touches. Return `true` to hit the entity. Return `false` or any other value to skip it. Setting this function makes traces slower." ret="[[{&#x22;s&#x22;:&#x22;fun&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;entity&#x22;},{&#x22;s&#x22;:&#x22;:&#x22;},{&#x22;s&#x22;:&#x22; &#x22;},{&#x22;s&#x22;:&#x22;client.C_BaseEntity&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/dumped_data/schema/client/C_BaseEntity&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;},{&#x22;s&#x22;:&#x22;:&#x22;},{&#x22;s&#x22;:&#x22; &#x22;},{&#x22;s&#x22;:&#x22;boolean&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#boolean&#x22;}]]" />
</ApiMembers>
