通过将此组件应用于由 2D 刚体物理组件控制的两个游戏对象,可使这些对象保持相对于彼此的位置,确保游戏对象始终以给定位置和角度偏移。这是一种 2D 弹簧式关节,但无需为其设置最大力。可以将弹簧设置为刚性或柔性。
请参阅下文的 2D 固定关节和 2D 相对关节进一步了解 2D 固定关节__和 2D 相对关节__之间的区别。
属性: | 功能: | ||
---|---|---|---|
Enable Collision | 选中此框可允许两个连接的游戏对象相互碰撞。 | ||
Connected Rigid Body | 指定此 2D 固定关节连接到的另一个游戏对象。将此属性保留为 None 可将 2D 固定关节的另一端固定到空间中由 Connected Anchor 设置所定义的点。选择字段右侧的圆圈可查看要连接到的游戏对象的列表。 | ||
Auto Configure Connected Anchor | 选中此框可为该 2D 固定关节连接到的另一个游戏对象自动设置锚点位置。如果选中此框,则无需填写 Connected Anchor 字段。 | ||
Anchor | 关节端点连接到此对象的位置(以 2D 刚体__上的 x、y 坐标表示)。 | |Connected Anchor__ | 2D 固定关节端点连接到另一游戏对象的位置(以 2D 刚体__上的 x、y 坐标表示)。 | |Damping Ratio__ | 定义想要抑制弹簧振荡的程度:介于 0 到 1 之间,值越大,移动越少。 |
Frequency | 游戏对象接近所需的间隔距离时弹簧振荡的频率(以每秒周期数表示)。频率值介于 1 到 1,000,000 范围内,值越高,弹簧越硬。请注意,如果频率设置为 0,则弹簧完全僵硬。 | ||
Break Force | 指定破坏并进而删除关节所需的作用力水平。Infinity 表示关节牢不可破。 | ||
Break Torque | 指定破坏并进而删除关节所需的扭矩水平。Infinity 表示关节牢不可破。 |
此关节的目的是保持两点之间的相对线性偏移和角度偏移。这两个点可以是两个 2D 刚体__组件,或一个 2D 刚体__组件和世界中的一个固定位置。(将 Connected Rigidbody 设置为 None,即可连接到世界中的固定位置)。
线性偏移和角度偏移基于两个连接点的相对位置和方向,因此可以通过在 Scene 视图中移动连接的游戏对象来更改这些偏移。
此关节对连接的 2D 刚体游戏对象施加线性力和扭力。此关节使用的模拟弹簧已预先配置为模拟所能提供的最大刚度。可使用 Frequency 设置来更改弹簧的值,从而降低其刚度。
弹簧在游戏对象之间施力时,往往会超过对象之间的期望距离,然后反复反弹,导致连续振荡。阻尼比率决定了振荡减弱并使游戏对象停止的速度。频率是弹簧在目标距离任一侧进行振荡的速率;频率越高,弹簧刚度越大。
2D 固定关节同时有两个约束:
使用此关节构建的物理游戏对象就好像是通过刚性连接方式相连一样。游戏对象不能彼此远离,不能相互靠近,也不能相对于彼此旋转,例如桥梁的各个部分采用刚性连接。
还可以使用此关节来创建刚度稍低的柔性连接,例如桥梁的各个部分略带柔性。
了解 2D 固定关节与 2D 相对关节之间的主要区别是非常重要的:
请参阅 2D 关节中的详情和提示以了解所有 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.