Hinge Joint 铰链关节

优质
小牛编辑
132浏览
2023-12-01

The Hinge Joint groups together two Rigidbodies, constraining them to move like they are connected by a hinge. It is perfect for doors, but can also be used to model chains, pendulums, etc.

铰链关节由两个刚体组成,约束它们像连在一个铰链上一样运动,适用于门,不过对于典型的链子、钟摆等同样适用。

The Hinge Joint Inspector 铰链关节检视面板
The Hinge Joint Inspector 铰链关节检视面板

Properties 属性

  • Connected Body 连接体 Optional reference to the Rigidbody that the joint is dependent upon. If not set, the joint connects to the world.
    为刚体指定的关节连接物,如不设定,则与世界相连
  • Anchor 锚点 The position of the axis around which the body swings. The position is defined in local space.
    主体摇摆围绕的锚点坐标,基于本地坐标系
  • Axis 坐标轴 The direction of the axis around which the body swings. The direction is defined in local space.
    摇摆方向的坐标,基于本地坐标系
  • Use Spring 是否使用弹簧 Spring makes the Rigidbody reach for a specific angle compared to its connected body.
    弹簧使刚体相对它连接的主体达到一个特定的角度
  • Spring 弹簧 Properties of the Spring that are used if Use Spring is enabled.
    用于如激活Use Spring的弹簧属性
  •     Spring 弹簧力 The force the object asserts to move into the position.
    维持对象移动到一定位置的力
  •     Damper 阻尼 The higher this value, the more the object will slow down.
    值越大,对象移动越慢
  •     Target Position 目标角度 Target angle of the spring. The spring pulls towards this angle measured in degrees.
    弹簧的目标角度。弹簧拉向这个角度,以角为单位
  • Use Motor 是否使用马达 The motor makes the object spin around.
    Motor使对象旋转
  • Motor 马达 Properties of the Motor that are used if Use Motor is enabled.
    用于如激活Use Motor的马达属性
  •     Target Velocity 目标速率 The speed the object tries to attain. 对象设法达到的速度
  •     Force 力 The force applied in order to attain the speed. 用于达到目标速率的力
  •     Free Spin 自由转动 If enabled, the motor is never used to brake the spinning, only accelerate it.
    如果启用,Motor永远不会破坏旋转,只会加速
  • Use Limits 是否有限制 If enabled, the angle of the hinge will be restricted within the Min & Max values.
    如果启用,铰链的角度将被限制在最大和最小之间
  • Limits 限制 Properties of the Limits that are used if Use Limits is enabled.
    用于如启用Use Limits 的边界属性
  •     Min 最小 The lowest angle the rotation can go. rotation能达到的最小角度
  •     Max 最大 The highest angle the rotation can go. rotation能达到的最大角度
  •     Min Bounce 最小弹跳 How much the object bounces when it hits the minimum stop.
    物体碰触最小限制时的弹跳值
  •     Max Bounce 最大弹跳 How much the object bounces when it hits the maximum stop.
    物体碰触最大限制时的弹跳值
  • Break Force 破坏力 The force that needs to be applied for this joint to break.
    允许这个铰链破损的力
  • Break Torque 破坏扭矩 The torque that needs to be applied for this joint to break.
    允许这个铰链破损的扭矩

Details 细节

A single Hinge Joint should be applied to a GameObject. The hinge will rotate at the point specified by the Anchor property, moving around the specified Axis property. You do not need to assign a GameObject to the joint's Connected Body property. You should only assign a GameObject to the Connected Body property if you want the joint's Transform to be dependent on the attached object's Transform.

单独的铰链关节要连在游戏对象上。铰链会绕着Anchor 属性指定的点,沿着 指定的Axis 属性方向移动。不需要给关节的Connected Body 属性分配游戏对象。只有希望关节的Transform依赖附加对象的Transform时,才需要分配游戏对象给Connected Body属性。

Think about how the hinge of a door works. The Axis in this case is up, positive along the Y axis. The Anchor is placed somewhere at the intersection between door and wall. You would not need to assign the wall to the Connected Body, because the joint will be connected to the world by default.

想一想门的铰链如何工作。Axis在这种情况下是向上的,沿Y轴正向。Anchor在门和墙交点的某处。不需要指定墙给Connected Body,因为关节默认会和世界相连。

Now think about a doggy door hinge. The doggy door's Axis would be sideways, positive along the relative X axis. The main door should be assigned as the Connected Body, so the doggy door's hinge is dependent on the main door's Rigidbody.

现在再想想狗门铰链。狗门的Axis 应该是侧向的,沿着X轴的正向。正门应该指定为Connected Body,这样狗门的铰链即依赖于正门的Rigidbody。

Chains 链条

Multiple Hinge Joints can also be strung together to create a chain. Add a joint to each link in the chain, and attach the next link as the Connected Body.

多个铰链关节也可以串起来变成一条链条。给链条的每一环添加一个关节,并附加下一环为其Connected Body。

Hints 提示

  • You do not need to assign a Connected Body to your joint for it to work.
    不需要指派Connected Body 来使关节运转。
  • Use Break Force in order to make dynamic damage systems. This is really cool as it allows the player to break a door off its hinge by blasting it with a rocket launcher or running into it with a car.
    用Break Force来制作动态破坏的系统。这确实很酷,可以让玩家用火箭发射器爆破或者用疾驶的汽车撞,来把门从铰链处弄碎。
  • The Spring, Motor, and Limits properties allow you to fine-tune your joint's behaviors.
    调整Spring、Motor和Limits属性可以改变关节的作用。