__2D 铰链关节__组件允许由 2D 刚体物理组件控制的游戏对象连接到空间中的一个点,使游戏对象可围绕该点旋转。可以让旋转被动发生(例如,对碰撞做出反应),也可通过 2D 关节本身提供的电机扭矩来主动为旋转提供动力。此外,还可以设置限制来防止铰链完全旋转或进行多次旋转。
属性: | 功能: | ||
---|---|---|---|
Enable Collision | 选中此框可允许两个连接的游戏对象之间发生碰撞。 | ||
Connected Rigid Body | 指定此 2D 铰链关节连接到的另一个游戏对象。如果将此属性保留为 None__,2D 铰链关节的另一端将固定到空间中由 Connected Anchor__ 设置所定义的点。选择字段右侧的圆圈可查看要连接到的游戏对象的列表。 | ||
Auto Configure Connected Anchor | 选中此框可为该 2D 铰链关节连接到的另一个游戏对象自动设置锚点位置。如果选中此框,则无需填写 Connected Anchor 字段。 | ||
Anchor | 定义 2D 摩擦关节的端点连接到此游戏对象的位置(以 2D 刚体__上的 x、y 坐标表示)。 | |Connected Anchor__ | 定义 2D 摩擦关节的端点连接到另一游戏对象的位置(以 2D 刚体__上的 x、y 坐标表示)。 | |Motor|此属性用于更改电机设置。| |Use Motor__ | 选中此框可启用铰链电机。 |
Motor Speed | 设置目标电机速度(度/秒)。 | ||
Maximum Motor Force | 设置在尝试达到目标速度时电机可以施加的最大扭矩(或旋转)。 | ||
Use Limits | 选中此框可限制旋转角度 | ||
Angle Limits | 如果已启用 Use Limits__,则可使用这些设置来设定限制。 | |Lower Angle__ | 设置此限制允许的旋转弧的下限。 | |
Upper Angle | 设置此限制允许的旋转弧的上限。 | ||
Break Force | 指定破坏并进而删除关节所需的线性(或直线)力水平。Infinity 表示关节牢不可破。 | ||
Break Torque | 指定破坏并进而删除关节所需的角度(或旋转)水平。Infinity 表示关节牢不可破。 |
2D 铰链关节的名称让人联想到门铰链。此关节既可以用作门铰链,也可以用作围绕特定点旋转的任何对象,例如:机器零件、动轮和钟摆。
可以使用此关节来让两个点重叠。这两个点可以是两个 2D 刚体__组件,或一个 2D 刚体__组件和世界中的一个固定位置。将 Connected Rigid Body 设置为 None,即可将 2D 铰链关节连接到世界中的固定位置。此关节对两个连接的 2D 刚体游戏对象施加线性力。
2D 铰链关节具有可开启和关闭的模拟旋转电机。设置 Maximum Motor Speed 和 Maximum Motor Force 可以控制角速度 (Torque) 并使两个 2D 刚体游戏对象相对于彼此进行弧形旋转。可使用 Lower Angle 和 Upper Angle 来设置弧度限制。
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.