2D 点效应器通过施力来吸引/排斥源点;源点可定义为效应器使用的刚体位置或碰撞体中心。另一(目标)碰撞体与效应器接触时,才对目标施力。可以控制施力的位置和计算方式。
用于效应器的碰撞体通常会设置为触发器,因此其他碰撞体可与其重叠以便施力,但是非触发器仍然有效,不过只有碰撞体与其接触时才会施力。
属性: | 功能: |
---|---|
Use Collider Mask | 是否应该使用“Collider Mask”属性?如果不应该,则所有碰撞体都默认采用全局碰撞矩阵。 |
Collider Mask | 此遮罩用于选择允许与效应器进行交互的特定层。 |
Force Magnitude | 要施加的力的大小。 |
Force Variation | 要施加的力的大小变化。 |
Distance Scale | 应用于源和目标之间距离的缩放。在计算此距离时,按该比值对距离进行缩放,因此可以改变有效距离,从而控制施力的大小。 |
Drag | 应用于刚体的线性阻力。 |
Angular Drag | 应用于刚体的角阻力。 |
Force Source | 力源是吸引或排斥目标对象的点。从该点定义相对于目标的距离。 |
Collider | 源点定义为碰撞体的当前位置。 |
Rigidbody | 源点定义为刚体的当前位置。 |
Force Target | 作用力目标 (Force Target) 是目标对象上由效应器施力的点。从该点定义相对于源的距离。 |
Collider | 目标点定义为碰撞体的当前位置。如果碰撞体没有位于质心处,则在此处施力会产生扭矩(导致目标旋转)。 |
Rigidbody | 目标点定义为刚体的当前质心。在此处施力绝对不会产生扭矩(导致目标旋转)。 |
Force Mode | 如何计算力。 |
Constant | 施力时忽略源和目标之间相隔的距离。 |
Inverse Linear | 施加的作用力以源和目标之间的反线性距离为函数。源和目标处于相同位置时施加全力,但是当源和目标移开时作用力呈线性下降。 |
Inverse Squared | 施加的作用力以源和目标之间的反平方距离为函数。源和目标处于相同位置时施加全力,但是当源和目标移开时作用力按平方下降。这类似于现实世界的重力。 |
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.