physics
Execute raycasts, spherecasts, and boxcasts, apply forces and torques, manage gravity, and step physics simulation in Unity.
Instructions
Unity Physics system control and queries. Actions:
raycast: Perform a raycast and return hit info
raycast_all: Raycast returning all hits
spherecast: Sphere-based raycast
boxcast: Box-based raycast
overlap_sphere: Find colliders in a sphere
overlap_box: Find colliders in a box
simulate: Step physics simulation manually
get_contacts: Get contact points between colliders
set_gravity: Set physics gravity
get_layer_collision: Get layer collision matrix
set_layer_collision: Set layer collision matrix
add_force: Add force to a Rigidbody
add_torque: Add torque to a Rigidbody
set_velocity: Set Rigidbody velocity
get_rigidbody_state: Get Rigidbody physics state
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | Force vector to apply | |
| action | Yes | Physics action to perform | |
| layer1 | No | First layer index for collision matrix | |
| layer2 | No | Second layer index for collision matrix | |
| origin | No | Ray/query origin point | |
| radius | No | Radius for sphere cast/overlap | |
| collide | No | Whether layers should collide | |
| gravity | No | New gravity vector | |
| objectId | No | Instance ID of the Rigidbody object | |
| velocity | No | Velocity vector to set | |
| direction | No | Ray direction (will be normalized) | |
| forceMode | No | Force application mode | |
| layerMask | No | Layer mask for filtering (default: all layers) | |
| maxResults | No | Maximum results for multi-hit queries | |
| objectPath | No | Hierarchy path of the Rigidbody object | |
| halfExtents | No | Half extents for box cast/overlap | |
| maxDistance | No | Maximum raycast distance | |
| orientation | No | Rotation quaternion for box queries | |
| queryTriggers | No | Include trigger colliders | |
| angularVelocity | No | Angular velocity to set | |
| simulationSteps | No | Number of physics simulation steps |