Pin Constraint
在 Forge Dynamics 模拟中将 Shape 固定在其原始位置,同时允许它们旋转。Shape 也可以由 motor 驱动,这意味着它们可用于齿轮、车轮或曲轴等概念。
Horizontal Alignment - 将 Constraint 的位置对齐到 Body 的左边缘 (-1) 或右边缘 (1)。
Vertical Alignment - 将 Constraint 的位置对齐到 Body 的上边缘 (1) 或下边缘 (-1)。
Motor - 当勾选时,固定的 Shape 会被赋予旋转力。
Motor Speed - 设置固定 Shape 的旋转速度。
Maximum Torque - 设置 Motor 的扭矩或力。较高的值意味着固定的 Shape 能够对抗密度更大的 Shape。
Limit Rotation - 当勾选时,Constraint 的旋转永远不会超过 Rotational Limits 的上限或下限。
Rotational Limits - 设置上限 (U) 和下限 (L) 角度以限制 Constraint 的旋转。
Tension - 当此值大于 0 时,Constraint 将尝试以弹簧般的行为返回其原始角度,值越高弹簧越强。当此值设置为 0 时,Constraint 将自由旋转。
Damping Ratio - 增大/减小 Constraint 旋转 ‘spring’ 的阻尼,值 0 = 弹跳振荡,1 = 平滑返回无弹跳。
Breakable - 当启用时,Constraint 可以被其他力打破。
Breaking Mode - 设置 Constraint 破裂的条件:
- Force - 当力超过 Breaking Force 时 Constraint 将破裂。
- Distance - 当 Constraint 移动超过其 Stretch Limit 时将破裂。
- Time - 当超过 Breaking Force 的力持续超过 Breaking Duration 定义的连续帧数时,Constraint 将破裂。
Breaking Force - 设置破裂 Constraint 所需的力的量。
Stretch Limit - 设置 Constraint 在破裂前被移动的 Rest Length 的倍数。例如,如果 Rest Length 为 100,Stretch Limit 为 2,则当拉伸到 100×2=200100 \times 2 = 200100×2=200 时 Constraint 将破裂。
Breaking Duration - 设置 Constraint 在破裂前必须承受超过 Breaking Force 的力的连续帧数。
Stress Threshold - 设置作为 Breaking Force 百分比的阈值,在此阈值内 Constraint 将破裂。
- 创建一个 Rectangle。
- 设置 Width 为
600,Height 为30。 - 创建一个 Ellipse。
- 设置 Ellipse 的 Position 为
100,400。 - 选择两个 Shape,点击 Shelf 中的 Forge 图标。
- 在 Forge Dynamics 的 Bodies 选项卡下,点击 Rectangle 的齿轮图标。
- 点击窗口底部 Constraints 属性旁边的 +,选择 Pin Constraint。
- 点击 Play
Ellipse 将下落并撞击 Rectangle,使其在固定位置旋转。