Token导航 LogoToken导航

Agent Skill · 研究检索

unity-physics(Unity physics 搜索)

unity-physics 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

unity-physics 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为只读;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 61,880。

总安装 346周安装 14GitHub Stars 14下载 109核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:unity-physics(Unity physics 搜索)
来源仓库:https://github.com/nice-wolf-studio/unity-claude-skills
仓库路径:skills/unity-physics
安装命令:
npx skills add https://github.com/nice-wolf-studio/unity-claude-skills --skill unity-physics
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/nice-wolf-studio/unity-claude-skills --skill unity-physics

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于查找、检索和筛选相关信息,适合快速定位候选结果。适用于关键词搜索、任务场景匹配和来源线索筛选。可结合仓库路径和原始 README 核验具体用法。安装方式:通过 GitHub 仓库安装,使用前确认权限与维护状态。注意是否会触发联网、命令执行或文件读写操作。

unity-physics 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/unity-physics

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/nice-wolf-studio/unity-claude-skills --skill u…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它标注为只读,先用只读任务试一次,确认行为符合预期再扩大使用范围。

常见问题

6 条

unity-physics 怎么安装?

在终端执行 npx skills add https://github.com/nice-wolf-studio/unity-claude-skills --skill unity-physi…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

unity-physics 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

unity-physics 需要什么权限?

权限级别是只读。该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

unity-physics 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

unity-physics 用的人多吗?

公开数据是累计安装 346 次,近一周安装 14 次,下载 109 次,GitHub 14 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

unity-physics 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。
  • 标注为只读权限,试用阶段不容易误改本地文件。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。
  • 只想先试试效果、不希望它改动本地文件的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
unity-physics

Unity physics 搜索 · 本页

34614只读未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Unity Physics

Physics System Overview

Unity provides different physics engine integrations for different project needs:

  • 3D Physics (PhysX): Nvidia PhysX engine integration for 3D object-oriented projects
  • 2D Physics (Box2D): Optimized 2D physics system with dedicated components
  • Both systems simulate gravity, collisions, forces, and constraints

Physics Timing

Physics runs on a fixed timestep via FixedUpdate, separate from the rendering frame rate:

void FixedUpdate()
{
    // All physics code belongs here, not in Update()
    rb.AddForce(Vector3.forward * speed);
}

Key timing rules:

  • FixedUpdate runs at a fixed interval (default 0.02s / 50Hz)
  • Multiple FixedUpdate calls can occur per frame, or none
  • Time.fixedDeltaTime controls the interval
  • Use Update for input, FixedUpdate for physics forces

Simulation Modes

Physics.simulationMode controls when the physics engine steps:

  • FixedUpdate (default): Automatic simulation each fixed timestep
  • Update: Simulate once per frame
  • Script: Manual control via Physics.Simulate()

Rigidbody Configuration

A Rigidbody component places a GameObject under physics engine control. A rigid body does not deform or change shape under physics forces.

Key Properties

PropertyDescriptionDefault
massMass in kg; affects force interactions1
linearDampingResistance to linear velocity0
angularDampingResistance to angular velocity0.05
useGravityWhether gravity affects this bodytrue
isKinematicIf true, not driven by physics forcesfalse
interpolationSmooths visual jitter between physics stepsNone
collisionDetectionModeAlgorithm for detecting collisionsDiscrete

Movement Methods

Rigidbody rb = GetComponent<Rigidbody>();

// Apply continuous force (call in FixedUpdate)
rb.AddForce(Vector3.forward * 10f);
rb.AddForce(Vector3.up * 5f, ForceMode.Impulse);

// Apply torque
rb.AddTorque(Vector3.up * 2f);

// Apply force at a world position (creates both force and torque)
rb.AddForceAtPosition(Vector3.forward * 10f, hitPoint);

// Kinematic movement (use for isKinematic=true bodies)
rb.MovePosition(rb.position + direction * speed * Time.fixedDeltaTime);
rb.MoveRotation(targetRotation);

ForceMode Options

ModeDescription
ForceMode.ForceContinuous force, uses mass (default)
ForceMode.AccelerationContinuous force, ignores mass
ForceMode.ImpulseInstant force, uses mass
ForceMode.VelocityChangeInstant force, ignores mass

Sleep State

When a Rigidbody's energy falls below the sleep threshold, the physics engine stops calculating it. Control manually with rb.Sleep() and rb.WakeUp().

Scale Warning

Unity assumes 1 world unit = 1 metre. Incorrect scale causes unrealistic physics behavior. Keep GameObjects at realistic proportions.


Colliders and Triggers

Colliders are invisible shapes that define a GameObject's physical boundaries. They do not need to match the visual mesh.

Collider Categories

CategoryDescription
Static ColliderCollider only, no Rigidbody. For immovable geometry (walls, floors).
Dynamic Rigidbody ColliderCollider + Rigidbody (isKinematic=false). Fully simulated.
Kinematic Rigidbody ColliderCollider + Rigidbody (isKinematic=true). Moved via script.

Collider Shapes

  • Primitive: BoxCollider, SphereCollider, CapsuleCollider -- efficient, auto-scale
  • Compound: Multiple primitives on child GameObjects for complex shapes
  • MeshCollider: Matches exact mesh geometry; expensive, use sparingly
  • WheelCollider: Raycast-based, built-in vehicle physics
  • TerrainCollider: Matches terrain heightmap

Trigger Colliders

Triggers detect overlapping colliders without physical collision response:

// Set via Inspector: Collider > Is Trigger = true
// Or via script:
GetComponent<BoxCollider>().isTrigger = true;

Requirements for trigger events:

  • At least one GameObject must have a Rigidbody
  • The collider must have isTrigger enabled
  • Each overlapping pair needs its own Rigidbody for individual detection

Physics Materials

Colliders support PhysicsMaterial with adjustable friction and bounciness properties for surface interactions.


Raycasting

Raycasting projects invisible rays to detect colliders in the scene.

Physics.Raycast

// Basic: check if anything is ahead
Vector3 fwd = transform.TransformDirection(Vector3.forward);
if (Physics.Raycast(transform.position, fwd, 10))
    Debug.Log("Something ahead!");

// With hit info
RaycastHit hit;
if (Physics.Raycast(transform.position, -Vector3.up, out hit, 100.0f))
    Debug.Log("Distance to ground: " + hit.distance);

// With layer mask
int layerMask = 1 << LayerMask.NameToLayer("Enemies");
if (Physics.Raycast(origin, direction, out hit, maxDist, layerMask))
    Debug.Log("Hit enemy: " + hit.collider.gameObject.name);

// Mouse-to-world raycast
Ray ray = Camera.main.ScreenPointToRay(Mouse.current.position.ReadValue());
if (Physics.Raycast(ray, out hit, 100))
    Debug.DrawLine(ray.origin, hit.point);

RaycastHit Properties

PropertyTypeDescription
pointVector3World-space hit position
normalVector3Surface normal at hit point
distancefloatDistance from ray origin
colliderColliderCollider that was hit
transformTransformTransform of the hit object

Other Cast Methods

MethodDescription
Physics.RaycastAll()Returns all intersections along the ray
Physics.RaycastNonAlloc()Fills a pre-allocated buffer (no GC alloc)
Physics.SphereCast()Sweeps a sphere along a direction
Physics.BoxCast()Sweeps a box along a direction
Physics.CapsuleCast()Sweeps a capsule along a direction
Physics.Linecast()Checks for colliders between two points

Overlap Queries (no direction, area check)

MethodDescription
Physics.OverlapSphere()Find all colliders within a sphere
Physics.OverlapBox()Find all colliders within a box
Physics.OverlapCapsule()Find all colliders within a capsule
Physics.CheckSphere()Returns true if any collider overlaps the sphere
Physics.CheckBox()Returns true if any collider overlaps the box
Physics.CheckCapsule()Returns true if any collider overlaps the capsule

QueryTriggerInteraction

Controls whether casts/overlaps detect trigger colliders:

  • QueryTriggerInteraction.UseGlobal -- uses Physics.queriesHitTriggers
  • QueryTriggerInteraction.Collide -- always detect triggers
  • QueryTriggerInteraction.Ignore -- never detect triggers

Collision Detection

Collision Detection Modes

ModeDescriptionUse Case
DiscreteChecks collisions at end of each physics step. High efficiency.Default for most objects
ContinuousChecks collisions over the entire step. Prevents tunneling.Fast objects hitting static geometry
Continuous DynamicContinuous detection against both static and dynamic collidersFast objects hitting other fast objects
Continuous SpeculativePredictive CCD using speculative contactsKinematic bodies, general CCD

Collision Callbacks

void OnCollisionEnter(Collision other) {  // First frame of contact
    if (other.gameObject.CompareTag("Player"))
        Debug.Log("Player hit this object");
}
void OnCollisionStay(Collision other) { }  // Every physics frame while touching
void OnCollisionExit(Collision other) { }  // Contact ended

Trigger Callbacks

void OnTriggerEnter(Collider other) {  // Entered trigger volume
    if (other.CompareTag("Player"))
        Debug.Log("Player entered trigger zone");
}
void OnTriggerStay(Collider other) {   // Each frame inside trigger
    other.attachedRigidbody?.AddForce(Vector3.up * 12f, ForceMode.Acceleration);
}
void OnTriggerExit(Collider other) { } // Left trigger volume

Collision Matrix

PairCollision EventsTrigger Events
Static + DynamicYes--
Static + KinematicNo--
Static + StaticNo--
Dynamic + DynamicYes--
Dynamic + KinematicYes--
Kinematic + KinematicNo--
Trigger + Dynamic/Kinematic--Yes
Static Trigger + Dynamic/Kinematic--Yes

At least one dynamic (non-kinematic) Rigidbody is required for collision events. The physics engine only applies forces to GameObjects with Rigidbody or ArticulationBody components.


Joints

Joints connect Rigidbody components together or to fixed points in space.

Joint TypeDescriptionUse Case
FixedJointLocks two bodies together (implemented as a spring)Attaching objects, breakable connections
HingeJointRotation around a single axisDoors, pendulums, chains
SpringJointElastic connection maintaining distanceBungees, tethers
CharacterJointBall-and-socket with constrained anglesRagdolls (hips, shoulders)
ConfigurableJointFully customizable constraintsAny specialized connection

Joint Properties

  • Connected Body: The other Rigidbody (null = fixed to world)
  • Anchor / Connected Anchor: Local-space attachment points
  • Break Force / Break Torque: Threshold to destroy the joint
  • Enable Preprocessing: Stabilizes the joint simulation

For industrial/robotics applications requiring precise articulation, use ArticulationBody instead of regular joints.


2D Physics Differences

Unity's 2D physics uses a separate engine optimized for 2D workflows.

Aspect3D2D
EnginePhysXBox2D
RigidbodyRigidbodyRigidbody2D
ColliderColliderCollider2D
Physics classPhysicsPhysics2D
VectorsVector3Vector2
RotationQuaternion (3-axis)float (Z-axis only)
GravityVector3Vector2
ForceModeForceModeForceMode2D

Rigidbody2D Body Types

TypeDescription
DynamicFully simulated, responds to forces and gravity
KinematicMoved via script, detects collisions but not affected by forces
StaticImmovable, for level geometry

2D Collider Types

BoxCollider2D, CircleCollider2D, CapsuleCollider2D, PolygonCollider2D, EdgeCollider2D, CompositeCollider2D, TilemapCollider2D

2D-Specific Features

  • Effectors 2D: Area, Buoyancy, Platform, Point, Surface effectors for force interactions
  • Constant Force 2D: Applies persistent force/torque
  • Physics Material 2D: Friction and bounce properties
  • LowLevelPhysics2D API: Independent low-level physics pathway

See reference file references/physics2d-api.md for full 2D API details.


Common Patterns

Player Movement with Rigidbody

public class PlayerMovement : MonoBehaviour
{
    public float moveSpeed = 5f;
    public float jumpForce = 7f;

    private Rigidbody rb;
    private bool jumpRequested;

    void Awake()
    {
        rb = GetComponent<Rigidbody>();
    }

    void Update()
    {
        // Capture input in Update (legacy Input Manager; see unity-input for new Input System)
        if (Input.GetButtonDown("Jump"))
            jumpRequested = true;
    }

    void FixedUpdate()
    {
        // Apply physics in FixedUpdate (legacy Input; see unity-input)
        float h = Input.GetAxis("Horizontal");
        float v = Input.GetAxis("Vertical");
        Vector3 move = new Vector3(h, 0f, v) * moveSpeed;
        rb.linearVelocity = new Vector3(move.x, rb.linearVelocity.y, move.z);

        if (jumpRequested)
        {
            rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
            jumpRequested = false;
        }
    }
}

Ground Check with SphereCast

// Cache collider reference in Awake() -- avoid GetComponent in hot paths
private CapsuleCollider capsule;
void Awake() => capsule = GetComponent<CapsuleCollider>();

public bool IsGrounded()
{
    float radius = 0.3f;
    return Physics.SphereCast(transform.position, radius, Vector3.down,
        out _, (capsule.height / 2f) - radius + 0.1f,
        LayerMask.GetMask("Ground"));
}

Hover Pad with Trigger

public class HoverPad : MonoBehaviour
{
    public float hoverForce = 12f;

    void OnTriggerStay(Collider other)
    {
        if (other.attachedRigidbody != null)
            other.attachedRigidbody.AddForce(Vector3.up * hoverForce, ForceMode.Acceleration);
    }
}

Non-Allocating Raycast (Zero GC)

private readonly RaycastHit[] hits = new RaycastHit[10];

void DetectEnemies()
{
    int count = Physics.RaycastNonAlloc(transform.position, transform.forward,
        hits, 50f, LayerMask.GetMask("Enemies"));
    for (int i = 0; i < count; i++)
        Debug.Log("Hit: " + hits[i].collider.name);
}

Anti-Patterns

Do NOT use Update for physics forces

// BAD: Forces applied at variable frame rate cause inconsistent behavior
void Update()
{
    rb.AddForce(Vector3.forward * 10f); // WRONG
}

// GOOD: Use FixedUpdate for physics
void FixedUpdate()
{
    rb.AddForce(Vector3.forward * 10f); // CORRECT
}

Do NOT move Rigidbody with Transform

// BAD: Bypasses physics, breaks collision detection
transform.position += Vector3.forward * speed * Time.deltaTime; // WRONG

// GOOD: Use Rigidbody methods
rb.MovePosition(rb.position + Vector3.forward * speed * Time.fixedDeltaTime); // CORRECT
// Or apply forces:
rb.AddForce(Vector3.forward * speed);

Do NOT use MeshCollider when primitives suffice

MeshCollider on a simple box-shaped object is wasteful. Use BoxCollider instead -- much cheaper and equally accurate for simple shapes. Reserve MeshCollider for complex concave geometry.

Do NOT allocate in physics callbacks

// BAD: GC allocation every collision
void OnCollisionEnter(Collision other) {
    var enemies = GameObject.FindGameObjectsWithTag("Enemy"); // WRONG
}
// GOOD: Cache in Start(), reuse in callbacks

Do NOT ignore layer masks in raycasts

Physics.Raycast(origin, direction, out hit);                        // BAD: hits everything
Physics.Raycast(origin, direction, out hit, 100f,
    LayerMask.GetMask("Ground", "Obstacles"));                      // GOOD: filtered

Key API Quick Reference

CategoryKey Members
Physics (static)Raycast, RaycastAll, RaycastNonAlloc, SphereCast, BoxCast, CapsuleCast, Linecast, OverlapSphere, OverlapBox, CheckSphere, CheckBox, ClosestPoint, ComputePenetration, Simulate, SyncTransforms
Physics propertiesgravity, defaultContactOffset, bounceThreshold, sleepThreshold, defaultSolverIterations, queriesHitTriggers, queriesHitBackfaces, simulationMode
Rigidbodymass, linearDamping, angularDamping, useGravity, isKinematic, linearVelocity, angularVelocity, interpolation, collisionDetectionMode, AddForce(), AddTorque(), MovePosition(), MoveRotation(), Sleep(), WakeUp()
CallbacksOnCollisionEnter(Collision), OnCollisionStay, OnCollisionExit, OnTriggerEnter(Collider), OnTriggerStay, OnTriggerExit

See references/physics3d-api.md for full method signatures, parameters, and overloads. See references/physics2d-api.md for the complete 2D physics API.


CharacterController

For non-physics-driven character movement (FPS controllers, NPCs), use CharacterController instead of Rigidbody. It handles slopes, steps, and collision sliding without physics simulation. See references/character-controller.md for full API, patterns, and CharacterController vs Rigidbody comparison.

Related Skills

  • unity-foundations -- GameObject hierarchy, components, transforms, layers
  • unity-scripting -- MonoBehaviour lifecycle (Update vs FixedUpdate), coroutines
  • unity-2d -- 2D game development patterns, sprite rendering

Additional Resources

平台分布

Codex

34.7%
按下载量换算38

Claude

32.72%
按下载量换算36

Cursor

18.17%
按下载量换算20

Gemini CLI

8.56%
按下载量换算9

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills