بنقرة واحدة
unity-physics
Use when users want to perform raycasts, overlap checks, or configure gravity.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Use when users want to perform raycasts, overlap checks, or configure gravity.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Use when working with a Unity project via MCP — creating or editing scenes, GameObjects, components, prefabs, materials, UI, lighting, navmesh, animations, terrain, C# scripts, or any other Unity Editor task.
Use when users want to run Unity tests or read test results.
Use when users want to enter play mode, select objects, undo/redo, or execute menu commands.
Use when creating, reading, editing, searching, validating, or deleting C# scripts in a Unity project.
Use when about to write or install a custom Editor script, add a [MenuItem], build a custom Editor window, or create a one-off Editor helper — to check whether a ready-to-paste template already exists in tooling/<domain>/ before reaching for Unity_CreateScript.
Use when users want to create Canvas, Button, Text, Image, or other UI elements.
| name | unity-physics |
| description | Use when users want to perform raycasts, overlap checks, or configure gravity. |
Raycasts, overlap checks, and gravity settings.
DO NOT (common hallucinations):
physics_add_rigidbody / physics_add_collider do not exist → use component_add with componentType "Rigidbody"/"BoxCollider"/etc.physics_simulate does not exist → physics simulation runs during Play modeRouting:
component modulephysics_create_material (this module)physics_set_layer_collision (this module)physics_raycastCast a ray and get hit info. Parameters:
originX, originY, originZ (float): Origin point.dirX, dirY, dirZ (float): Direction vector.maxDistance (float, optional): Max distance (default 1000).layerMask (int, optional): Layer mask (default -1).Returns: { hit: true, collider: "Cube", distance: 5.2, ... }
physics_check_overlapCheck for colliders in a sphere. Parameters:
x, y, z (float): Center point.radius (float): Sphere radius.layerMask (int, optional): Layer mask.physics_get_gravityGet global gravity setting. Parameters: None.
physics_set_gravitySet global gravity setting. Parameters:
x, y, z (float): Gravity vector (e.g. 0, -9.81, 0).physics_raycast_allCast a ray and return ALL hits (penetrating).
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| originX | float | Yes | - | Ray origin X |
| originY | float | Yes | - | Ray origin Y |
| originZ | float | Yes | - | Ray origin Z |
| dirX | float | Yes | - | Direction X |
| dirY | float | Yes | - | Direction Y |
| dirZ | float | Yes | - | Direction Z |
| maxDistance | float | No | 1000 | Max ray distance |
| layerMask | int | No | -1 | Layer mask filter |
Returns: { count, hits: [{ objectName, instanceId, path, point, normal, distance }] }
physics_spherecastCast a sphere along a direction and get hit info.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| originX | float | Yes | - | Origin X |
| originY | float | Yes | - | Origin Y |
| originZ | float | Yes | - | Origin Z |
| dirX | float | Yes | - | Direction X |
| dirY | float | Yes | - | Direction Y |
| dirZ | float | Yes | - | Direction Z |
| radius | float | Yes | - | Sphere radius |
| maxDistance | float | No | 1000 | Max cast distance |
| layerMask | int | No | -1 | Layer mask filter |
Returns: { hit, objectName, instanceId, point, distance }
physics_boxcastCast a box along a direction and get hit info.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| originX | float | Yes | - | Origin X |
| originY | float | Yes | - | Origin Y |
| originZ | float | Yes | - | Origin Z |
| dirX | float | Yes | - | Direction X |
| dirY | float | Yes | - | Direction Y |
| dirZ | float | Yes | - | Direction Z |
| halfExtentX | float | No | 0.5 | Box half extent X |
| halfExtentY | float | No | 0.5 | Box half extent Y |
| halfExtentZ | float | No | 0.5 | Box half extent Z |
| maxDistance | float | No | 1000 | Max cast distance |
| layerMask | int | No | -1 | Layer mask filter |
Returns: { hit, objectName, instanceId, point, distance }
physics_overlap_boxCheck for colliders overlapping a box volume.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| x | float | Yes | - | Box center X |
| y | float | Yes | - | Box center Y |
| z | float | Yes | - | Box center Z |
| halfExtentX | float | No | 0.5 | Box half extent X |
| halfExtentY | float | No | 0.5 | Box half extent Y |
| halfExtentZ | float | No | 0.5 | Box half extent Z |
| layerMask | int | No | -1 | Layer mask filter |
Returns: { count, colliders: [{ objectName, path, isTrigger }] }
physics_create_materialCreate a PhysicMaterial asset.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| name | string | No | "New PhysicMaterial" | Material name |
| savePath | string | No | "Assets" | Save directory path |
| dynamicFriction | float | No | 0.6 | Dynamic friction value |
| staticFriction | float | No | 0.6 | Static friction value |
| bounciness | float | No | 0 | Bounciness value |
Returns: { success, path }
physics_set_materialSet PhysicMaterial on a collider (supports name/instanceId/path).
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| materialPath | string | Yes | - | Asset path of the PhysicMaterial |
| name | string | No | null | GameObject name |
| instanceId | int | No | 0 | GameObject instance ID |
| path | string | No | null | GameObject hierarchy path |
Returns: { success, gameObject, material }
physics_get_layer_collisionGet whether two layers collide.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| layer1 | int | Yes | - | First layer index |
| layer2 | int | Yes | - | Second layer index |
Returns: { layer1, layer2, collisionEnabled }
physics_set_layer_collisionSet whether two layers collide.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| layer1 | int | Yes | - | First layer index |
| layer2 | int | Yes | - | Second layer index |
| enableCollision | bool | No | true | Whether to enable collision |
Returns: { success, layer1, layer2, collisionEnabled }
Recipe path rule: ../../recipes/physics/<command>.md