当目标 2D 碰撞体与 2D 区域效应器接触时,2D 效应器会在附加的 2D 碰撞体所定义的区域内施力。您可以在任何角度为此力配置特定幅度以及该幅度内的随机变化。还可以应用线性阻力和角阻力来减慢 2D 刚体的速度。
与 2D 区域效应器结合使用的 2D 碰撞体通常会设置为触发器,这样其他 2D 碰撞体就能与其重叠,从而施力。非触发器仍然有效,但只有 2D 碰撞体与其接触时才会施力。
属性: | 功能: |
---|---|
Use Collider Mask | 选中此选项可启用 Collider Mask 属性。如果未启用此选项,则所有 2D 碰撞体都将默认采用全局碰撞矩阵 (Global Collision Matrix)。 |
Collider Mask | 此遮罩用于选择允许与 2D 区域效应器进行交互的特定层。 |
Use Global Angle | 选中此选项可将 Force Angle 定义为全局(世界空间)角度。如果未选中,物理引擎会将 Force Angle 视为局部角度。 |
Force Angle | 要施加的力的角度。 |
Force Magnitude | 要施加的力的大小。 |
Force Variation | 要施加的力的大小变化。 |
Drag | 应用于 2D 刚体的线性阻力。 |
Angular Drag | 应用于 2D 刚体的角阻力。 |
Force Target | 2D 区域效应器在目标游戏对象上施力的作用点。 |
Collider | 目标点定义为 2D 碰撞体的当前位置。如果 2D 碰撞体没有位于质心处,则在此处施力会产生扭矩(旋转)。 |
Rigidbody | 目标点定义为 2D 刚体的当前质心。在此处施力绝对不会产生扭矩(旋转)。 |
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.