This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
专业(SIM)
UnigineEditor
界面概述
资源工作流程
版本控制
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

关节 (Joints)

Joints provide constraints removing degrees of freedom from a body and are used to connect pairs of bodies. Each joint has an anchor point, which is by default placed between the centers of mass of connected bodies. The properties of each connection depend on the selected joint type and its parameters. Joint parameters can be divided into two groups:关节提供了限制,从而消除了物体(body)的自由度,并用于连接成对的body。每个关节都有一个锚点,默认情况下,该锚点位于连接实体的质心之间。每个连接的属性取决于所选的关节类型及其参数。联合参数可以分为两组:

  • Common parameters — basic set of parameters shared by all joints. 通用参数 -所有关节共享的基本参数集。
  • Type-specific parameters — a set of specific parameters for each joint type. 类型特定的参数-每种关节类型的一组特定参数。

See also也可以看看#

Programming implementation:编程实现:

Usage examples:用法示例:

Fragment of video tutorial on physics about joints关于关节的物理视频教程的片段

Adding a Joint添加关节#

Assume you have two objects with physical bodies assigned. Remember that a body must have a shape assigned. To connect them using a joint via UnigineEditor, perform the following steps:假设您有两个分配了物理物体的对象。请记住,物体必须具有指定的形状。要通过 UnigineEditor 使用关节来连接它们,请执行以下步骤:

  • Open the World Hierarchy window. 打開 World Hierarchy 窗口。
  • Select the first body to connect.选择第一个要连接的物体
  • Go to the Physics tab in the Parameters window.转到 Parameters窗口中的Physics選項卡。
  • In the Joints section, choose an appropriate type of joint and click Add.

    Adding a joint

    Joints 部分中,选择适当的关节类型,然后单击Add

    添加关节

  • Select the second body by picking its name in the dialog window and click Ok.
    Selecting a body
    在对话框窗口中选择第二个物体的名称,然后单击Ok
    Selecting a body
  • Set joint parameters in the Joints section.Joints部分中设置关节参数。

You can enable visualization of the joint by checking Helpers panel → Physics item → Joints option (Visualizer should be enabled).您可以通过选中Helpers面板→Physics项目→Joints选项(应启用Visualizer)来启用关节的可视化。

Fixed JointFixed Joint#

Fixed joints connect two bodies in a manner that strictly preserves their positions with respect to each other.固定关节以严格保持彼此位置的方式连接两个物体。

Fixed joint
Fixed Joint
Fixed Joint Parameters Fixed Joint参数

The basic constraint parameters of this joint include:此关节的基本约束参数包括:

Rotation 0 Specifies orientation of the first body relative to the anchor point.指定第一个实体相对于锚点的方向。
Rotation 1 Specifies orientation of the second body relative to the anchor point指定第二个实体相对于锚点的方向

This joint also has a set of common parameters shared by all joint types.此关节还具有一组由所有关节类型共享的通用参数

For more information refer to JointFixed Class description. An example illustrating connection of two bodies using a fixed joint can be found here.有关更多信息,请参见JointFixed类描述。 此处

Watch the illustration of the Fixed joint in our video tutorial on physics.在我们的物理视频教程中观看固定关节的插图。

Hinge JointHinge Joint#

Hinge joints allow the connected bodies to rotate along the joint's axis at the anchor point. This joint has an angular motor attached.铰链关节允许连接的实体在锚点处沿关节的轴旋转。该关节连接了一个有角度的 motor

Hinge joint Hinge joint
Hinge Joint
Hinge Joint Parameters Hinge Joint参数

The basic constraint parameters of this joint include:此关节的基本约束参数包括:

Joint axis Coordinates of the joint axis, around which the bodies rotate.物体绕其旋转的关节轴的坐标。
Angular damping Angular damping coefficient of the hinge joint.铰链接头的角阻尼系数。
Angular limit from Minimum angle in the range of movement at which the hinge stops. The angle is specified in degrees in the [-180; 180] range.铰链停止运动范围内的最小角度。角度在[ -180 中以度为单位指定; 180 ]范围。
Angular limit to Maximum angle in the range of movement at which the hinge stops. The angle is specified in degrees in the [-180; 180] range.铰链停止运动范围内的最大角度。角度在[ -180 中以度为单位指定; 180 ]范围。
Angular spring Spring rigidity coefficient, determines how strong the joint resists rotation. If rigidity is set to 0, the spring is disabled.弹簧刚度系数确定关节抵抗旋转的强度。如果将刚度设置为 0 ,则会禁用弹簧。
Angular angle Target angle of the attached angular spring. The spring (if it is enabled) tries to keep the specified angle between the connected bodies.附加角弹簧的目标角度。弹簧(如果已启用)将尝试使连接的物体之间保持指定的角度。
電機參數
Angular Torque Maximum torque of the angular motor. 0 detaches the motor.角度电机的最大扭矩。 0 拆下电动机。
Angular Velocity Target velocity of the attached angular motor.附加角电机的目标速度。

This joint also has a set of common parameters shared by all joint types.此关节还具有一组由所有关节类型共享的通用参数

For more information refer to JointHinge Class description. An example illustrating connection of two bodies using a hinge joint can be found here.有关更多信息,请参见JointHinge类描述。可以在此处找到使用铰链接头连接两个物体的示例。

Watch the illustration of the Hinge joint settings in our video tutorial on physics.在我们的物理视频教程中观看铰链关节设置的图示。

Ball JointBall Joint#

Ball joints provide a point around which the connected objects can rotate.球形接头提供了一个连接对象可以围绕其旋转的点。

Ball joint Ball joint
Ball Joint
Ball Joint Parameters Ball Joint参数

The basic constraint parameters of this joint include:此关节的基本约束参数包括:

Joint axis Coordinates of the joint axis.关节轴的坐标。
Angular limit angle Swing angle limit, specifies how much connected bodies can bend from the joint axis.摆动角度限制,指定连接的物体可以从关节轴弯曲多少。
Angular limit from Minimum angle in the range of twisting around the joint axis. The angle is specified in degrees in the [-180; 180] range.围绕关节轴扭转范围内的最小角度。角度在[ -180 中以度为单位指定; 180 ]范围。
Angular limit to Maximum angle in the range of twisting around the joint axis. The angle is specified in degrees in the [-180; 180] range.在围绕关节轴的扭曲范围内的最大角度。角度在[ -180 中以度为单位指定; 180 ]范围。

This joint also has a set of common parameters shared by all joint types.此关节还具有一组由所有关节类型共享的通用参数

For more information refer to JointBall Class description. An example illustrating connection of two bodies using a ball joint can be found here.有关更多信息,请参考 JointBall类描述。可以在此处找到使用球形接头连接两个物体的示例。

Watch the illustration of the Ball joint settings in our video tutorial on physics.在我们的物理视频教程中观看球形关节设置的图示。

Prismatic JointPrismatic Joint#

Prismatic joints allow movement along the joint axis. This joint has a linear motor attached.棱形关节允许沿关节轴移动。该关节具有连接的线性 motor

Prismatic joint Prismatic joint
Prismatic Joint
Prismatic Joint Parameters Prismatic Joint参数

The basic constraint parameters of this joint include:此关节的基本约束参数包括:

Joint axis Coordinates of the joint axis.关节轴的坐标。
Linear damping Linear damping coefficient of the prismatic joint.棱柱形接头的线性阻尼系数。
Linear limit from Minimum distance between the bodies along the joint axis.物体之间沿关节轴的最小距离。
Linear limit to Maximum distance between the bodies along the joint axis.物体之间沿关节轴的最大距离。
Linear spring Spring rigidity coefficient, determines how strong the joint resists linear motion. If rigidity is set to 0, the spring is disabled.弹簧刚度系数,确定接头抵抗线性运动的强度。如果将刚度设置为 0 ,则会禁用弹簧。
Linear distance Target linear distance of the attached spring. The spring (if it is enabled) tries to keep the specified distance between the connected bodies.所连接弹簧的目标线性距离。弹簧(如果启用)会尝试保持连接的实体之间的指定距离。
電機參數
Linear Force Maximum force of the attached linear motor. 0 detaches the motor.连接的直线电动机的最大力。 0 拆下电动机。
Linear Velocity Target velocity of the attached linear motor.附加直线电机的目标速度。

This joint also has a set of common parameters shared by all joint types.此关节还具有一组由所有关节类型共享的通用参数

For more information refer to JointPrismatic Class description. An example illustrating connection of two bodies using a prismatic joint can be found here.有关更多信息,请参见JointPrismatic类描述。可以在此处找到使用棱镜连接两个物体的示例。

Watch the illustration of the Prismatic joint in our video tutorial on physics.在我们的物理学视频教程中观看棱柱关节的图示。

Cylindrical JointCylindrical Joint#

Cylindrical joints are like prismatic ones with an additional degree of freedom: rotation around the joint axis. This joint has a linear and an angular motors attached.圆柱关节就像棱柱形关节一样,具有额外的自由度:绕关节轴旋转。该关节具有线性和成角度的电动机

Cylindrical joint Cylindrical joint
Cylindrical Joint
Cylindrical Joint Parameters Cylindrical Joint参数

The basic constraint parameters of this joint include:此关节的基本约束参数包括:

Joint axis Coordinates of the joint axis.关节轴的坐标。
Linear damping Linear damping coefficient of the cylindrical joint.圆柱接头的线性阻尼系数。
Linear limit from The minimum distance between the bodies along the joint axis.物体之间沿关节轴的最小距离。
Linear limit to The maximum distance between the bodies along the joint axis.物体之间沿关节轴的最大距离。
Linear spring Spring rigidity coefficient, determines how strong the joint resists linear motion. If rigidity is set to 0, the spring is disabled.弹簧刚度系数,确定接头抵抗线性运动的强度。如果将刚度设置为 0 ,则会禁用弹簧。
Linear distance A target linear distance of the attached spring. The spring (if it is enabled) tries to keep the specified distance between the connected bodies.所连接弹簧的目标线性距离。弹簧(如果启用)会尝试保持连接的实体之间的指定距离。
Angular damping Angular damping coefficient of the cylindrical joint.圆柱接头的角阻尼系数。
Angular limit from The minimum angle in the range of twisting around the joint axis. The angle is specified in degrees in the [-180; 180] range.围绕关节轴扭转范围内的最小角度。角度在[ -180 中以度为单位指定; 180 ]范围。
Angular limit to The maximum angle in the range of twisting around the joint axis. The angle is specified in degrees in the [-180; 180] range.在围绕关节轴的扭曲范围内的最大角度。角度在[ -180 中以度为单位指定; 180 ]范围。
Angular spring Spring rigidity coefficient, determines how strong the joint resists rotation. If rigidity is set to 0, the spring is disabled.弹簧刚度系数确定关节抵抗旋转的强度。如果将刚度设置为 0 ,则会禁用弹簧。
Angular angle A target angle of the attached angular spring. The spring (if it is enabled) tries to keep the specified angle between the connected bodies.所连接的角弹簧的目标角度。弹簧(如果已启用)将尝试使连接的物体之间保持指定的角度。
電機參數
Angular Torque Maximum torque of the angular motor. 0 detaches the motor.角度电机的最大扭矩。 0 拆下电动机。
Angular Velocity Target velocity of the attached angular motor.附加角电机的目标速度。
Linear Force Maximum force of the attached linear motor. 0 detaches the motor.连接的直线电动机的最大力。 0 拆下电动机。
Linear Velocity Target velocity of the attached linear motor.附加直线电机的目标速度。

This joint also has a set of common parameters shared by all joint types.此关节还具有一组由所有关节类型共享的通用参数

For more information refer to JointCylindrical Class description. An example illustrating connection of two bodies using a cylindrical joint can be found here.有关更多信息,请参见JointCylindrical类描述。 此处

Watch the illustration of the Cylindrical joint in our video tutorial on physics.在我们的物理视频教程中观看圆柱关节的插图。

Wheel JointWheel Joint#

Wheel joints are used to create ray-cast vehicle wheels. It connects two rigid bodies: the first body is a frame, the second one is a wheel. There is no need to assign a shape to the wheel: ray casting is used to detect collision of the wheel with a surface. This joint has an angular motor attached.车轮节用于制造射线铸型的车轮。它连接两个刚性实体:第一个实体是框架,第二个实体是轮子。无需为车轮指定形状:射线投射用于检测车轮与表面的碰撞。该关节连接了一个有角度的 motor

注意

The order of the bodies, connected using a wheel joint, matters!物体的顺序,通过车轮接头事项连接!

  • If the bodies are connected using UnigineEditor:如果物体使用 UnigineEditor 连接:

    1. Select the vehicle frame.选择车架。
    2. Add a wheel joint.添加车轮接头。
    3. Specify the wheel to be attached.指定要安装的轮子。
  • If the bodies are connected programmatically:如果物体以编程方式连接:

    • b0 is a frame. b0是一个框架。
    • b1 is a wheel. b1 是一個輪子.
Wheel joint Wheel joint
Wheel Joint
Wheel Joint Parameters Wheel Joint参数

The basic constraint parameters of this joint include:此关节的基本约束参数包括:

Suspension axis (Axis 0) 悬架轴(Axis 0 Coordinates of a vertical axis, which acts like a cylindrical joint providing steering and damping.垂直轴的坐标,其作用类似于提供转向和阻尼的圆柱关节。
Wheel spindle axis (Axis 1) 车轮主轴轴(Axis 1

Coordinates of a horizontal axis, around which the wheel rotates. They are set in the following fields:车轮绕其旋转的水平轴的坐标。它们在以下字段中设置:

  • Axis 10 — in the coordinate system of the frame (which is body 0) Axis 10-在框架的坐标系中(即body 0
  • Axis 11 — in the coordinate system of the wheel (which is body 1) Axis 11-在车轮坐标系中(即body 1
Linear damping Linear damping coefficient of the suspension.悬架的线性阻尼系数。
Linear limit from Lower suspension ride limit.悬架行驶下限。
Linear limit to Upper suspension ride limit.悬架行驶上限。
Linear spring Suspension spring rigidity coefficient, determines how strong the joint resists vertical linear motion. If rigidity is set to 0, the spring is disabled.悬架弹簧刚度系数确定关节抵抗垂直线性运动的强度。如果将刚度设置为 0 ,则会禁用弹簧。
Linear distance Target suspension height. The suspension spring (if it is enabled) tries to keep the specified height.目标悬架高度。悬架弹簧(如果启用)会尝试保持指定的高度。
Angular damping Angular damping coefficient of wheel rotation.车轮旋转的角阻尼系数。
電機參數
Angular Torque Maximum torque of the angular motor. 0 detaches the motor.角度电机的最大扭矩。 0 拆下电动机。
Angular Velocity Target velocity of the attached angular motor.附加角电机的目标速度。

This joint also has a set of common parameters shared by all joint types.此关节还具有一组由所有关节类型共享的通用参数

For more information refer to JointWheel Class description. For an example illustrating the use of wheel joints see the Creating a Car with Wheel Joints article.有关更多信息,请参见JointWheel类描述。有关说明使用车轮节的示例,请参见使用车轮节创建汽车文章。

Watch how to simulate a wheel using the Wheel joint in our video tutorial on physics.在我们的物理视频教程中,观看如何使用Wheel关节模拟车轮。

Suspension JointSuspension Joint#

警告
This joint type is deprecated and will be removed in the upcoming releases. It is recommended to use the Wheel Joint instead.此联合类型已被弃用,并将在以后的版本中删除。建议改用车轮接头

Suspension joints are used to create wheel suspension for vehicles. It connects two rigid bodies: the first body is a frame, the second one is a wheel. This joint has an angular motor attached.悬架用于制造车辆的车轮悬架。它连接两个刚性实体:第一个实体是框架,第二个实体是轮子。该关节连接了一个有角度的 motor

注意
The order of the bodies, connected using a suspension joint, matters!
  • If the bodies are connected using UnigineEditor:If the bodies are connected using UnigineEditor:

    1. Select the vehicle frame.Select the vehicle frame.
    2. Add a suspension joint.Add a suspension joint.
    3. Specify the wheel to be attached.Specify the wheel to be attached.
  • If the bodies are connected programmatically:If the bodies are connected programmatically:

    • b0 is a frame.b0 is a frame.
    • b1 is a wheel.b1 is a wheel.
If the bodies are connected using UnigineEditor:Select the vehicle frame.Add a suspension joint.Specify the wheel to be attached.If the bodies are connected programmatically:b0 is a frame.b1 is a wheel.
车身的顺序,通过悬架连接事项
  • If the bodies are connected using UnigineEditor:如果物体使用 UnigineEditor 连接:

    1. Select the vehicle frame.选择车架。
    2. Add a suspension joint.添加悬架接头。
    3. Specify the wheel to be attached.指定要安装的轮子。
  • If the bodies are connected programmatically:如果物体以编程方式连接:

    • b0 is a frame. b0是一个框架。
    • b1 is a wheel. b1 是一個輪子.
Suspension joint Suspension joint
Suspension Joint
Suspension Joint Parameters Suspension Joint参数

The basic constraint parameters of this joint include:此关节的基本约束参数包括:

Suspension axis (Axis 0) 悬架轴(Axis 0 Coordinates of a vertical axis, which acts like a cylindrical joint providing steering and damping.垂直轴的坐标,其作用类似于提供转向和阻尼的圆柱关节。
Wheel spindle axis (Axis 1) 车轮主轴轴(Axis 1

Coordinates of a horizontal axis, around which the wheel rotates. They are set in the following fields:车轮绕其旋转的水平轴的坐标。它们在以下字段中设置:

  • Axis 10 — in the coordinate system of the frame (which is body 0) Axis 10-在框架的坐标系中(即body 0
  • Axis 11 — in the coordinate system of the wheel (which is body 1) Axis 11-在车轮坐标系中(即body 1
Linear damping Linear damping coefficient of the suspension.悬架的线性阻尼系数。
Linear limit from Lower suspension ride limit.悬架行驶下限。
Linear limit to Upper suspension ride limit.悬架行驶上限。
Linear spring Suspension spring rigidity coefficient, determines how strong the joint resists vertical linear motion. If rigidity is set to 0, the spring is disabled.悬架弹簧刚度系数确定关节抵抗垂直线性运动的强度。如果将刚度设置为 0 ,则会禁用弹簧。
Linear distance Target suspension height. The suspension spring (if it is enabled) tries to keep the specified height.目标悬架高度。悬架弹簧(如果启用)会尝试保持指定的高度。
Angular damping Angular damping coefficient of wheel rotation.车轮旋转的角阻尼系数。
電機參數
Angular Torque Maximum torque of the angular motor. 0 detaches the motor.角度电机的最大扭矩。 0 拆下电动机。
Angular Velocity Target velocity of the attached angular motor.附加角电机的目标速度。

This joint also has a set of common parameters shared by all joint types.此关节还具有一组由所有关节类型共享的通用参数

For more information refer to JointSuspension Class description. An example illustrating connection of two bodies using a suspension joint can be found here.有关更多信息,请参见JointSuspension类描述。可以在此处找到使用悬架关节连接两个物体的示例。

For the difference between the Suspension and Wheel joints, see our video tutorial on physics.有关悬架和车轮关节之间的区别,请参见我们的有关物理的视频教程

Path JointPath Joint#

Path joint is used to attach a rigid body to a path body and to make it move along this path. This joint can be used to make a train move along the tracks. This joint has a linear motor attached.路径关节用于将刚体附加到路径体,并使其沿该路径移动。该接头可用于使火车沿着轨道移动。该关节具有连接的线性 motor

注意

Assign a shape to a rigid body before connecting it to a path body!
The order of the bodies, connected using a path joint, matters!
形状分配给刚体,然后再将其连接到路径体!
使用此關節連接的物理物體的順序很重要

  • If the bodies are connected using UnigineEditor:
    1. Select a rigid body.Select a rigid body.
    2. Add a path joint.Add a path joint.
    3. Specify the path body.Specify the path body.
    Select a rigid body.Add a path joint.Specify the path body.
    如果物体使用 UnigineEditor 连接:
    1. Select a rigid body.选择刚体。
    2. Add a path joint.添加路径关节。
    3. Specify the path body.指定路径物体。
  • If the bodies are connected programmatically:
    • b0 is a BodyRigid.b0 is a BodyRigid.
    • b1 is a BodyPath.b1 is a BodyPath.
    b0 is a BodyRigid.b1 is a BodyPath.
    如果物体以编程方式连接:
    • b0 is a BodyRigid. b0 是一個 BodyRigid
    • b1 is a BodyPath. b1 是一個 BodyPath
Path joint
Path Joint
Path Joint Parameters Path Joint参数

The basic constraint parameters of this joint include:此关节的基本约束参数包括:

Rotation Specifies orientation of the body relative to the path.指定物体相对于路径的方向。
Linear damping Linear damping coefficient of the path joint.路径关节的线性阻尼系数。
電機參數
Linear Force Maximum force of the attached linear motor. 0 detaches the motor.连接的直线电动机的最大力。 0 拆下电动机。
Linear Velocity Target velocity of the attached linear motor.附加直线电机的目标速度。

This joint also has a set of common parameters shared by all joint types.此关节还具有一组由所有关节类型共享的通用参数

For more information refer to JointPath Class description. An example illustrating connection of two bodies using a path joint can be found here.有关更多信息,请参见JointPath类描述。可以在此处找到使用路径关节连接两个物体的示例。

Our video tutorial on physics shows how to attach a rigid body to a path body using the Path joint.我们的物理视频教程显示了如何使用“路径”关节将刚体连接到路径体。

Particles JointParticles Joint#

Particles joint is used to pin cloth body or rope body to a rigid body, ragdoll body or a dummy body.粒子关节用于将衣服物体绳索物体固定到刚性物体布娃娃物体虚拟物体

注意

The order of the bodies, connected using a particles joint, matters!物体的顺序,通过粒子连接要点连接!

  • If the bodies are connected using UnigineEditor:如果物体使用 UnigineEditor 连接:

    1. Select a rigid body, a ragdoll body or a dummy body.选择刚体,布娃娃体或虚拟体。
    2. Add a particles joint.添加粒子关节。
    3. Specify a cloth body or a rope body.指定布料物体或绳索物体。
  • If the bodies are connected programmatically:如果物体以编程方式连接:

    • b0 is a BodyRigid / BodyRagdoll / BodyDummy. b0 是一個 BodyRigid / BodyRagdoll / BodyDummy
    • b1 is a BodyCloth / BodyRope. b1 是一個 BodyCloth / BodyRope
Particles joint
Particles Joint
Particles Joint Parameters Particles Joint参数

The basic constraint parameters of this joint include:此关节的基本约束参数包括:

Threshold Determines the distance for pinning vertices of cloth or rope body to another body.确定将布料或绳索物体的顶点固定到另一个物体的距离。
Size Specifies the area for pinning vertices of cloth or rope body to another body.指定将布料或绳索物体的顶点固定到另一个物体的区域。

This joint also has a set of common parameters shared by all joint types.此关节还具有一组由所有关节类型共享的通用参数

For more information refer to JointParticles Class description. An example illustrating attachment of a cloth body using a particles joint can be found here.有关更多信息,请参见JointParticles类描述。可以在此处找到一个示例,该示例说明了使用粒子关节连接衣服物体

An example illustrating the use of rope body and particles joint can be found here.可以在此处找到使用绳体和粒子关节的示例。

Our video tutorial on physics shows how to attach a rope or a cloth to other bodies using the Particles joint.我们的物理视频教程展示了如何使用“粒子”关节将绳索或布料连接到其他物体。

Common Joint Parameters共同关节参数#

Common Joint Parameters通用关节参数

All joints regardless of their type have some common parameters:所有关节,无论其类型如何,都有一些共同的参数:

Enabled A flag indicating if a joint is enabled.指示是否启用关节的标志。
Collision A flag indicating if collision detection between the connected bodies is enabled.一个标志,指示是否在连接的物体之间启用碰撞检测
Anchor Position of the anchor point around which the joint's motion is constrained. By default the anchor is placed between the centers of mass of connected bodies.约束关节运动的锚点位置。默认情况下,锚点位于连接的实体的重心之间。
Linear restitution

Linear stiffness of the joint. Defines how fast it compensates for linear coordinate change between two bodies. When bodies are dragged apart, restitution controls the magnitude of force which is applied to both bodies so that their anchor points to become aligned again.关节的线性刚度。定义补偿两个物体之间线性坐标变化的速度。将物体拉开时,恢复力控制施加在两个物体上的力的大小,以使它们的锚点再次对齐。

  • 1 means that the joint is to return bodies in place throughout 1 physics tick. 1 表示关节将在整个1个物理滴答中返回到位。
  • 0.2 means that the joint is to return bodies in place throughout 5 physics ticks. 0.2 表示关节将在整个5个物理滴答中将物体返回到位。
注意
The maximum value of 1 can lead to destabilization of physics (as too great forces are applied). 1 的最大值可能导致物理不稳定(因为施加的力过大)。
Angular restitution

Angular stiffness of the joint. Defines how fast it compensates for change of the angle between two bodies. When bodies are turned relative each other, restitution controls the magnitude of force which is applied to both bodies so that their anchor points to become aligned again.关节的角刚度。定义补偿两个物体之间角度变化的速度。当物体彼此相对旋转时,恢复力控制施加到两个物体的力的大小,以使它们的锚点再次对齐。

  • 1 means that the joint is to return bodies in place throughout 1 physics tick. 1 表示关节将在整个1个物理滴答中返回到位。
  • 0.2 means that the joint is to return bodies in place throughout 5 physics ticks. 0.2 表示关节将在整个5个物理滴答中将物体返回到位。
注意
The maximum value of 1 can lead to destabilization of physics (as too great forces are applied). 1 的最大值可能导致物理不稳定(因为施加的力过大)。
Linear softness

Linear elasticity of the joint. Defines whether linear velocities of the bodies are averaged out when the joint is stretched.关节的线弹性。定义在拉伸关节时是否将实体的线速度平均化。

  • 0 means that the joint is rigid. Velocities of the first and the second body are independent. 0 表示关节是刚性的。第一和第二物体的速度是独立的。
  • 1 means that the joint is elastic (jelly-like). If the first body changes its velocity, velocity of the second body is equalized with it. 1 表示关节具有弹性(果冻状)。如果第一个物体的速度发生变化,则第二个物体的速度将与其相等。
Angular softness

Angular elasticity of the joint. Defines whether linear velocities of the bodies are averaged out when the joint is twisted.关节的角度弹性。定义在扭曲关节时是否将实体的线速度平均化。

  • 0 means that the joint is rigid. Velocities of the first and the second body are independent. 0 表示关节是刚性的。第一和第二物体的速度是独立的。
  • 1 means that the joint is elastic (jelly-like). If the first body changes its velocity, velocity of the second body is equalized with it. 1 表示关节具有弹性(果冻状)。如果第一个物体的速度发生变化,则第二个物体的速度将与其相等。
Max force Maximum force that can be exerted on the joint. If this limit is exceeded, the joint breaks. The default value is inf, i.e. the joint is unbreakable.可以在关节上施加的最大力。如果超过此限制,则关节会断裂。默认值为 inf ,即关节是不可破坏的。
Max torque Maximum torque that can be exerted on the joint. If this limit is exceeded, the joint breaks. The default value is inf, i.e. the joint is unbreakable.可以施加在关节上的最大扭矩。如果超过此限制,则关节会断裂。默认值为 inf ,即关节是不可破坏的。
Number of iterations Joints, like collisions, are calculated iteratively. This parameter specifies the number of iterations used to solve joints. Note that if this value is too low, the precision of calculations will suffer.关节像碰撞一样被迭代计算。此参数指定用于求解关节的迭代次数。请注意,如果此值太低,则会影响计算的精度。

Motors and Springs马达和弹簧#

Joints can have motors and springs associated with them.关节可以具有与之关联的电动机和弹簧。

Springs try to keep the bodies connected with a joint at some specific distance (linear) or angle (angular). The behavior of a particular spring depends on its rigidity and damping coefficient. 弹簧尝试使物体与关节保持一定的距离(线性)或角度(角度)。特定弹簧的性能取决于其刚度和阻尼系数。

Motors provide movement or rotation of bodies connected with a joint relative to each other by applying a torque (or force) to a joint's degree of freedom. There are linear and angular motors that exert a limited force to a joint, pushing or rotating connected objects. 电动机通过向关节的自由度施加扭矩(或力),使与关节连接的物体彼此相对运动或旋转。有 linear angular 个电动机会向关节施加有限的力,推动或旋转连接的物体。

Springs and Motors

Motors have two parameters:电动机具有两个参数:

  • Target velocity
  • Maximum force (or torque) that is available to reach that velocity.达到该速度的最大力(或扭矩)。

This is a very simple model of real life motors. However, is it quite useful when modeling a motor, that is geared down with a gearbox before being connected to the joint. Such devices are often controlled by setting a target velocity, and can only generate a maximum amount of power to achieve that speed (which corresponds to a certain amount of force available at the joint).这是现实生活中的电机非常简单的模型。但是,在建模电动机时非常有用,该电动机在连接到关节之前先用齿轮箱减速。此类设备通常是通过设置目标速度来控制的,并且只能产生最大功率以达到该速度(这对应于关节处可用的一定量的力)。

To activate an angular motor perform the following steps:启动角度电动机,请执行以下步骤:

  1. Set angular velocity — target angular velocity of the motor, This value determines how fast the motor can rotate.设置angular velocity-电动机的目标角速度,该值确定电动机可以旋转的速度。

    • positive value — the motor rotates counterclockwise. 正值-电动机逆时针旋转。
    • negative value — the motor rotates clockwise. 负值-电动机顺时针旋转。
  2. Set angular torque — maximum torque applied by the motor to reach target velocity. This value determines how fast the motor reaches maximum velocity.设置angular torque-电机达到目标速度所施加的最大转矩。该值确定电动机达到最大速度的速度。

    • 0 disables the motor. 0 禁用电动机。
    • If a negative value is provided, 0 will be used instead.如果提供负值,则将使用 0

To activate a linear motor perform the following steps:启动线性电动机,请执行以下步骤:

  1. Set linear velocity — target linear velocity of the motor, This value determines how fast the motor can push.设置linear velocity-电动机的目标线速度,该值确定电动机可以推动多快。

    • positive value — the motor pushes forward. 正值-电动机向前推动。
    • negative value — the motor pulls backward. 负值-电动机向后拉动。
  2. Set linear force — maximum force applied by the motor to reach target velocity. This value determines how fast the motor reaches maximum velocity.设置linear force-电机达到目标速度所施加的最大力。该值确定电动机达到最大速度的速度。

    • 0 disables the motor. 0 禁用电动机。
    • If a negative value is provided, 0 will be used instead.如果提供负值,则将使用 0

Vehicles汽车#

Vehicles are important in real-time games, therefore, they are to be described separately. There are two approaches to simulation of moving vehicles. Each approach has a corresponding joint type to connect wheels to vehicle body.车辆在实时游戏中很重要,因此,将分别对其进行描述。有两种模拟移动车辆的方法。每种方法都有对应的关节类型,用于将车轮连接至车身。

  • The first approach uses a suspension joint and assumes that wheels are represented as physical bodies with shapes. As each wheel has a collider shape, collisions with objects on the ground are handled correctly. For example, such car runs on a curb smoothly. This approach requires more calculations and is to be used when more accurate simulation is needed especially for step-like ground surface and wheels have a complex shape. 第一种方法使用suspension joint并假定将车轮表示为具有形状的物理物体。由于每个车轮都具有对撞机形状,因此可以正确处理与地面上的物体的碰撞。例如,这种汽车在路缘上平稳行驶。这种方法需要进行更多的计算,并且在需要更精确的仿真时尤其是对于阶状地面和形状复杂的车轮时应使用。
  • The second approach uses a wheel joint and assumes that the wheels are virtual. Wheels do not collide with the surface of the road. Instead, rays are cast down from the car body to detect surface unevenness. In this case steep changes of the terrain are not handled accurately. This approach is faster then the first one and provides acceptable results for smooth terrain, e.g. for racing cars simulation. However, on cross-country terrains it may not work correctly. 第二种方法使用wheel joint并假定车轮是虚拟的。车轮不会与路面碰撞。取而代之的是,将射线从车身投射下来以检测表面不平整。在这种情况下,不能正确处理地形的陡峭变化。这种方法比第一种更快,并且可以为平滑地形提供可接受的结果,例如用于赛车模拟。但是,在越野地形上,它可能无法正常工作。

Both joints have a motor associated with them, which rotates the wheels and pushes the vehicle forward.两个关节都有一个与它们关联的 motor ,它使车轮旋转并向前推动车辆。

光线投射和陡峭障碍物的问题

A problem with the wheels simulated using ray casting使用射线投射模拟车轮的问题
最新更新: 2023-06-23
Build: ()