raycast
Cast a ray through PhysX to find which collider lies along a line, returning its prim, hit point, surface normal and distance, or no hit.
Instructions
Cast a ray through PhysX and return the closest collider it hits: its prim, the hit point, the surface normal and the distance in stage units, or "No hit".
Use it to find what lies along a line, such as the ground under a point or what a robot faces; get_prim_bounds measures a prim you already know. Only colliders (the Collision API, which set_physics_properties' collision=True or create_prim's enable_physics adds) are hit, not plain meshes. PhysX needs to know the scene: play or step the simulation once first, or it may find nothing, or fail. The prim named is the rigid body hit, or a static collider itself.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"origin": "<origin>",
"direction": "<direction>"
},
"name": "raycast"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| origin | Yes | [x, y, z] start point in world space | |
| direction | Yes | [dx, dy, dz] direction in world space, of any length but zero | |
| max_distance | No | The longest the ray goes, in stage units |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |