用于 2D 物理的全局设置和 Helper 方法。
AllLayers | 包括所有层的层遮罩常量。 |
angularSleepTolerance | A Rigidbody cannot sleep if its angular velocity is above this tolerance threshold. |
autoSyncTransforms | Set whether to automatically sync changes to the Transform component with the physics engine. |
baumgarteScale | 控制解析重叠速度的缩放因子。 |
baumgarteTOIScale | 控制解析 TOI 重叠速度的缩放因子。 |
callbacksOnDisable | 用于控制 Collider2D 处于禁用状态时是否应调用相应的 OnCollisionExit2D 或 OnTriggerExit2D 回调。 |
defaultContactOffset | The default contact offset of the newly created Colliders. |
defaultPhysicsScene | Unity 启动时自动创建的 PhysicsScene2D。 |
DefaultRaycastLayers | 层遮罩常量,包括默认情况下参与射线投射的所有层。 |
gravity | 重力产生的加速度。 |
IgnoreRaycastLayer | 忽略射线投射的默认层的层遮罩常量。 |
jobOptions | 一组选项,用于控制在使用作业系统进行多线程物理模拟时物理系统的工作方式。 |
linearSleepTolerance | 如果刚体的线性速率高于该公差,将无法进入睡眠状态。 |
maxAngularCorrection | 解算约束时使用的最大角位置校正。这有助于防止过冲。 |
maxLinearCorrection | 解算约束时使用的最大线性位置校正。这有助于防止过冲。 |
MaxPolygonShapeVertices | The maximum number of vertices allowed per primitive polygon shape type (PhysicsShapeType2D.Polygon). (Read Only) |
maxRotationSpeed | 每次物理更新时,刚体的最大角速度。增大该值可能会导致数值问题。 |
maxTranslationSpeed | 每次物理更新时,刚体的最大线性速度。增大该值可能会导致数值问题。 |
positionIterations | 考虑对象位置时,物理解算器的迭代次数。 |
queriesHitTriggers | 射线投射是否检测配置为触发器的碰撞体? |
queriesStartInColliders | Set the raycasts or linecasts that start inside Colliders to detect or not detect those Colliders. |
reuseCollisionCallbacks | 确定垃圾回收器是否应仅对所有冲突回调重用一个 Collision2D 类型的实例。 |
simulationMode | Controls when Unity executes the 2D physics simulation. |
timeToSleep | 刚体进入睡眠状态前必须保持静止的时间(以秒为单位)。 |
velocityIterations | 考虑对象速度时,物理解算器的迭代次数。 |
velocityThreshold | 将相对线性速度低于该阈值的任何碰撞都视为非弹性碰撞。 |
BoxCast | Casts a box against Colliders in the Scene, returning the first Collider to contact with it. |
BoxCastAll | Casts a box against Colliders in the Scene, returning all Colliders that contact with it. |
BoxCastNonAlloc | Casts a box into the Scene, returning Colliders that contact with it into the provided results array. Note: This method will be deprecated in a future build and it is recommended to use BoxCast instead. |
CapsuleCast | Casts a capsule against Colliders in the Scene, returning the first Collider to contact with it. |
CapsuleCastAll | Casts a capsule against Colliders in the Scene, returning all Colliders that contact with it. |
CapsuleCastNonAlloc | Casts a capsule into the Scene, returning Colliders that contact with it into the provided results array. Note: This method will be deprecated in a future build and it is recommended to use CapsuleCast instead. |
CircleCast | Casts a circle against Colliders in the Scene, returning the first Collider to contact with it. |
CircleCastAll | 向场景中的碰撞体投射圆形,返回与圆形接触的所有碰撞体。 |
CircleCastNonAlloc | Casts a circle into the Scene, returning Colliders that contact with it into the provided results array. Note: This method will be deprecated in a future build and it is recommended to use CircleCast instead. |
ClosestPoint | Returns a point on the perimeter of the Collider that is closest to the specified position. |
Distance | Calculates the minimum distance between two Colliders. |
GetContacts | Retrieves all Colliders in contact with the Collider. |
GetIgnoreCollision | 检查碰撞检测系统是否忽略 collider1 与 collider2 之间的所有碰撞/触发器。 |
GetIgnoreLayerCollision | 检查是否忽略指定层之间的碰撞。 |
GetLayerCollisionMask | 获取碰撞层遮罩,指示指定层可以与哪些层发生碰撞。 |
GetRayIntersection | Cast a 3D ray against the Colliders in the Scene returning the first Collider along the ray. |
GetRayIntersectionAll | Cast a 3D ray against the Colliders in the Scene returning all the Colliders along the ray. |
GetRayIntersectionNonAlloc | Cast a 3D ray against the Colliders in the Scene returning the Colliders along the ray. Note: This method will be deprecated in a future build and it is recommended to use GetRayIntersection instead. |
IgnoreCollision | 使碰撞检测系统忽略 collider1 与 collider2 之间的所有碰撞/触发器。 |
IgnoreLayerCollision | 选择检测还是忽略指定层对之间的碰撞。 |
IsTouching | Checks whether the passed Colliders are in contact or not. |
IsTouchingLayers | Checks whether the Collider is touching any Colliders on the specified layerMask or not. |
Linecast | Casts a line segment against Colliders in the Scene. |
LinecastAll | Casts a line against Colliders in the Scene. |
LinecastNonAlloc | Casts a line against Colliders in the Scene. Note: This method will be deprecated in a future build and it is recommended to use Linecast instead. |
OverlapArea | 检查碰撞体是否位于一个矩形区域内。 |
OverlapAreaAll | Get a list of all Colliders that fall within a rectangular area. |
OverlapAreaNonAlloc | Get a list of all Colliders that fall within a specified area. Note: This method will be deprecated in a future build and it is recommended to use OverlapArea instead. |
OverlapBox | 检查碰撞体是否在一个盒形区域内。 |
OverlapBoxAll | Get a list of all Colliders that fall within a box area. |
OverlapBoxNonAlloc | Get a list of all Colliders that fall within a box area. Note: This method will be deprecated in a future build and it is recommended to use OverlapBox instead. |
OverlapCapsule | 检查碰撞体是否位于一个胶囊体区域内。 |
OverlapCapsuleAll | Get a list of all Colliders that fall within a capsule area. |
OverlapCapsuleNonAlloc | Get a list of all Colliders that fall within a capsule area. Note: This method will be deprecated in a future build and it is recommended to use OverlapCapsule instead. |
OverlapCircle | Checks if a Collider falls within a circular area. |
OverlapCircleAll | Get a list of all Colliders that fall within a circular area. |
OverlapCircleNonAlloc | Get a list of all Colliders that fall within a circular area. Note: This method will be deprecated in a future build and it is recommended to use OverlapCircle instead. |
OverlapCollider | Gets a list of all Colliders that overlap the given Collider. |
OverlapPoint | Checks if a Collider overlaps a point in space. |
OverlapPointAll | Get a list of all Colliders that overlap a point in space. |
OverlapPointNonAlloc | Get a list of all Colliders that overlap a point in space. Note: This method will be deprecated in a future build and it is recommended to use OverlapPoint instead. |
Raycast | 向场景中的碰撞体投射射线。 |
RaycastAll | Casts a ray against Colliders in the Scene, returning all Colliders that contact with it. |
RaycastNonAlloc | Casts a ray into the Scene. Note: This method will be deprecated in a future build and it is recommended to use Raycast instead. |
SetLayerCollisionMask | 设置碰撞层遮罩,指示指定层可以与哪些层发生碰撞。 |
Simulate | 在场景中进行物理模拟。 |
SyncTransforms | 同步。 |
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.