Talos docs

POST /raycast

Since 0.6

One ray { from, dir, … }, or several under { "rays": [...] }.

Plain text

The body is read as JSON first and matched here rather than by Body, so a body of neither shape is told what the endpoint takes (RAYCAST_BODY) and not only which field was missing.

Request

Body fields

fielddefaultNotes
excludenonean entity id, or a list of them, the ray passes straight through. An id the scene does not have is a 404
exclude_tagsnonea tag, or a list; every entity carrying one is passed through too
triggerstruewhether trigger volumes count as hits, as ctx.world.raycast has it

Request body: RaycastRequest

POST /raycast request: one ray.

FieldTypeRequiredDescription
fromnumber[3]yesRay origin in world space, [x, y, z]. origin is accepted for it: agents guessed { origin, direction, maxDistance } three runs in a row and were refused each time.
dirnumber[3]yesRay direction. Need not be normalized, but must not be the zero vector. direction is accepted for it.
maxnumbernoMaximum distance in metres. Defaults to 1000. maxDistance and max_distance are accepted for it.
excludestring[]noEntity ids the ray passes straight through: an id or a list of them. A ray cast down from above the player starts outside its capsule and hits it first; "exclude": "player" sees past it. An id the scene does not have is a 404, so a typo is not a silent no-op.
exclude_tagsstring[]noEvery entity carrying any of these tags is passed through as well: a tag or a list. excludeTags, as ctx.world.raycast spells it, is accepted for it.
triggersbooleannoWhether trigger volumes count as hits. Default true, as ctx.world.raycast has it; pass false for a line of sight or a ground probe that should see through a volume.

Request body: RaycastBatch

POST /raycast with { "rays": [ … ] }: several rays, cast on one frame, answered in order.

FieldTypeRequiredDescription
raysRaycastRequest[]yesThe rays, each the single-ray body.

Response

Response: HitView

What a ray found. POST /raycast responds with this or with null.

FieldTypePresentDescription
entitystringalwaysThe entity the ray struck, by id.
pointnumber[3]alwaysWorld-space point of impact.
normalnumber[3]alwaysSurface normal at the impact point.
distancenumberalwaysDistance from from along the normalized direction, in metres.
frameintegeralwaysThe frame the cast ran on.

Example

curl -X POST "http://127.0.0.1:7700/raycast" --json @body.json

Start a server with argus run --serve; the port is --port (7700 by default). The request and response fields are in the query API guide.