全局物理属性和 Helper 方法。
AllLayers | 用于选择所有层的层遮罩常量。 |
autoSyncTransforms | 当 Transform 组件发生更改时,是否自动将变换更改与物理系统同步。 |
bounceThreshold | 两个相对速度低于该值的对象碰撞后将不反弹(默认为 2)。必须为正值。 |
clothGravity | 布料重力设置。 设置所有 Cloth 组件的重力。 |
defaultContactOffset | 新创建的碰撞体的默认接触偏移。 |
defaultMaxAngularSpeed | 动态刚体的默认最大角速率,以弧度为单位(默认为 50)。 |
defaultMaxDepenetrationVelocity | The maximum default velocity needed to move a Rigidbody's collider out of another collider's surface penetration. Must be positive. |
defaultPhysicsScene | Unity 启动时自动创建的 PhysicsScene。 |
DefaultRaycastLayers | 用于选择默认射线投射层的层遮罩常量。 |
defaultSolverIterations | defaultSolverIterations 确定刚体关节与碰撞接触点的解析精确度(默认为 6)。必须为正值。 |
defaultSolverVelocityIterations | defaultSolverVelocityIterations 影响刚体关节与碰撞接触点的解析精确度(默认为 1)。必须为正值。 |
gravity | 应用于场景中所有刚体的重力。 |
IgnoreRaycastLayer | 用于选择忽略射线投射层的层遮罩常量。 |
improvedPatchFriction | Enables an improved patch friction mode that guarantees static and dynamic friction do not exceed analytical results. |
interCollisionDistance | 设置布料相互碰撞的最小间隔距离。 |
interCollisionStiffness | 设置布料相互碰撞的刚度。 |
invokeCollisionCallbacks | Whether or not MonoBehaviour collision messages will be sent by the physics system. |
queriesHitBackfaces | 物理查询是否应该击中背面三角形。 |
queriesHitTriggers | 指定默认情况下查询(射线投射、球形投射、重叠测试等)是否命中触发器。 |
reuseCollisionCallbacks | 确定垃圾回收器是否应仅对所有冲突回调重用一个碰撞类型的实例。 |
simulationMode | Controls when Unity executes the physics simulation. |
sleepThreshold | 经过质量标准化的能量阈值 - 当低于该阈值时,对象开始进入睡眠状态。 |
BakeMesh | Prepares the mesh for use with a MeshCollider and uses default cooking options. |
BoxCast | 沿射线投射盒体并返回有关命中对象的详细信息。 |
BoxCastAll | 与 Physics.BoxCast 类似,但返回所有命中对象。 |
BoxCastNonAlloc | 沿该方向投射盒体,并将命中对象存储在提供的缓冲区中。 |
CapsuleCast | 向场景中的所有碰撞体投射胶囊体,并返回有关命中对象的详细信息。 |
CapsuleCastAll | 与 Physics.CapsuleCast 类似,但该函数将返回胶囊体扫描相交的所有命中对象。 |
CapsuleCastNonAlloc | 向场景中的所有碰撞体投射胶囊体,并在缓冲区中返回有关命中对象的详细信息。 |
CheckBox | 检查给定的盒体是否与其他碰撞体重叠。 |
CheckCapsule | 检查是否有任何碰撞体与世界空间中的胶囊形体积重叠。 |
CheckSphere | 如果有任何碰撞体与世界坐标系中由 position 和 radius 界定的球体重叠,则返回 true。 |
ClosestPoint | 返回给定碰撞体上最接近指定位置的点。 |
ComputePenetration | 计算在指定姿势下将给定碰撞体分开所需的最小平移。 |
GetIgnoreCollision | 检查碰撞检测系统是否忽略 collider1 与 collider2 之间的所有碰撞/触发器。 |
GetIgnoreLayerCollision | 是否忽略 layer1 与 layer2 之间的碰撞? |
IgnoreCollision | 使碰撞检测系统忽略 collider1 与 collider2 之间的所有碰撞。 |
IgnoreLayerCollision | 使碰撞检测系统忽略 layer1 中的任何碰撞体与 layer2 中的任何碰撞体之间的所有碰撞。注意,IgnoreLayerCollision 将重置受影响的碰撞体的触发器状态,因此,您可能会收到调用该函数导致的 OnTriggerExit 和 OnTriggerEnter 消息。 |
Linecast | 如果有任何碰撞体与 start 和 end 之间的线相交,则返回 true。 |
OverlapBox | 查找与给定盒体接触或位于盒体内部的所有碰撞体。 |
OverlapBoxNonAlloc | 查找与给定盒体接触或位于盒体内部的所有碰撞体,并将它们存储到缓冲区中。 |
OverlapCapsule | 在物理世界中检查给定胶囊体,并返回所有重叠的碰撞体。 |
OverlapCapsuleNonAlloc | 在物理世界中检查给定胶囊体,并在用户提供的缓冲区中返回所有重叠的碰撞体。 |
OverlapSphere | 计算并存储接触球体或位于球体内部的碰撞体。 |
OverlapSphereNonAlloc | 计算与球体接触或位于球体内部的碰撞体,并将它们存储到提供的缓冲区中。 |
Raycast | 向场景中的所有碰撞体投射一条射线,该射线起点为 /origin/,朝向 /direction/,长度为 /maxDistance/。 |
RaycastAll | 向场景中投射射线并返回所有命中对象。注意,这些结果的顺序未定义。 |
RaycastNonAlloc | 向场景中投射射线,并将命中对象存储到缓冲区中。 |
RebuildBroadphaseRegions | 重新构建粗筛阶段涉及的区域并设置世界边界。 |
Simulate | 在场景中进行物理模拟。 |
SphereCast | 沿射线投射球体并返回有关命中对象的详细信息。 |
SphereCastAll | 与 Physics.SphereCast 类似,但该函数将返回球体扫描相交的所有命中对象。 |
SphereCastNonAlloc | 沿该方向投射球体,并将结果存储到缓冲区中。 |
SyncTransforms | 将 Transform 更改应用于物理引擎。 |
ContactEvent | Subscribe to this event to read all collisions that occurred during the physics simulation step. |
ContactModifyEvent | Subscribe to this event to be able to customize the collision response for contact pairs. |
ContactModifyEventCCD | Subscribe to this event to be able to customize the collision response of CCD generated contact pairs. |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.