Skip to main content
Collision queries against the map’s physics world. Positions take any Vec3Like.
Without a map loaded every query returns null, the boolean ones too. Check for null before .hit.

Overview

Filters

Presets, filter, ignore, clearIgnore.

Rays and sweeps

ray, rayAll, box, sphere, capsule.

Point queries

isVisible, isSolid, overlapSphere, closestPoint.

Results

TraceResult, OverlapResult, ClosestPointResult.

Filters

Every query takes a filter last: a preset name, a trace.filter() object, or inline options. Omitted means "bullet".

filter


A reusable filter. Build it once at the top level and pass it every tick.
Options you leave out keep the preset’s value. Tags: pass_bullets, player_clip, npc_clip, grenade_clip, ladder, window, sky, player, thrown_grenade, solid, block_los, block_light, block_sound.

ignore


Queries pass through these entities, at most 8 per filter. Both return the filter, so they chain.

Rays and sweeps

ray


Casts one ray and returns the first hit, see TraceResult. null without a map.

rayAll


Every hit along the ray, up to maxHits (default 32, max 128). null without a map.

Sweeps


Moves a shape from start to end and stops at the first hit. Box mins/maxs are relative to the moving position.

Point queries

isVisible


Line of sight through world geometry. Players don’t block it. null without a map.
Checking one entity from another? entity.isVisible picks the eye positions for you.

isSolid


Whether point is inside solid geometry, using the "everything" preset. null without a map.

overlapSphere


Every collider touching the sphere. null without a map.

closestPoint


The nearest surface point within maxDistance, or null when there’s none (or no map).
Of the filter only static and dynamic apply here. Preset rules, tags and ignore are not honoured.

Results

OverlapResult has position, normal, depth (penetration), entity and entityIndex. ClosestPointResult has position, normal, distance, entity and entityIndex.

Example

Shows what’s under your crosshair.