Physics 2D Settings 可用于提供 2D 物理的全局设置(菜单:__Edit__ > Project Settings > __Physics 2D__)。
(还有一个适用于 3D 项目的对应 Physics Manager。)
属性: | 功能: |
---|---|
Gravity | 应用于所有 2D 刚体游戏对象的重力大小。通常,仅为 y 轴的负方向设置重力。 |
Default Material | 在没有为单独 2D 碰撞体分配材质的情况下,使用的默认 2D 物理材质。 |
Velocity Iterations | 物理引擎为处理速度影响而进行的迭代次数。数字越大,物理属性越准确,但代价是 CPU 时间增加。 |
Position Iterations | 物理引擎为处理位置变化而进行的迭代次数。数字越大,物理属性越准确,但代价是 CPU 时间增加。 |
Velocity Threshold | 相对速度低于此值的碰撞被视为非弹性碰撞(即,碰撞的游戏对象不会相互反弹)。 |
Max Linear Correction | 解算约束时使用的最大线性位置校正(范围从 0.0001 到 1000000)。这有助于防止过冲。 |
Max Angular Correction | 解算约束时使用的最大角度校正(范围从 0.0001 到 1000000)。这有助于防止过冲。 |
Max Translation Speed | 任何物理更新期间 2D 刚体游戏对象的最大线性速度。 |
Max Rotation Speed | 任何物理更新期间 2D 刚体游戏对象的最大线性速度。 |
Min Penetration For Penalty | 在施加任何分离冲击力之前允许的最小接触穿透半径。 |
Baumgarte Scale | 用于确定解算碰撞重叠速度的缩放因子。 |
Baumgarte Time of Impact Scale | 用于确定解算撞击时间重叠速度的缩放因子。 |
Time to Sleep | 在 2D 刚体停止移动之后而进入睡眠状态之前必须经过的时间(以秒为单位)。 |
Linear Sleep Tolerance | 如果低于该线性速度,2D 刚体在经过 Time to Sleep 过后进入睡眠状态。 |
Angular Sleep Tolerance | 如果低于该旋转速度,2D 刚体在经过 Time to Sleep 过后进入睡眠状态。 |
Queries Hit Triggers | 选中此框可让标记为__触发器__的 2D 碰撞体在任何物理查询(如线性投射或射线投射)与它们相交时返回命中。取消选中此框会使这些查询不返回命中。 |
Queries Start In Colliders | 选中此框可使 2D 碰撞体中启动的物理查询检测是在哪个碰撞体中开始的。 |
Change Stops Callbacks | 选中此框时,如果删除或移动了碰撞中涉及的任何游戏对象,可立即停止报告碰撞回调。 |
Layer Collision Matrix | 定义基于层的碰撞检测系统的行为方式。 |
Physics 2D Settings 定义了物理模拟精度的限制。一般来说,更精确的模拟需要更多的处理开销,因此这些设置提供了一种精度与性能的折衷方法。有关更多信息,请参阅本手册的物理部分。
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.