Q3 Physics Joints
Since Rev. 2724 we provide joint setup for colliders in Q3 Physics engine.
It is possible to setup joints at design and at runtime.
We support a few standard joint types:
JointType | Description |
---|---|
TQ3JointType.Fixed | Constrains two rigid bodies together, removing their ability to act independent of each other. |
TQ3JointType.BallAndSocket | Allows motion around an indefinite number of axes. Humans have such joints in the hips and shoulders. |
TQ3JointType.Hinge | Allows free rotation on one axis. Can be used for spinning wheels and carousels. |
TQ3JointType.LimitedHinge | Allows limited articulation on one axis. Humans have such joints in the fingers and knees. |
TQ3JointType.Prismatic | Constrains two bodies to a sliding motion on one axis. Can be used to make various sliding doors. |
TQ3JointType.StiffSpring | Constrains two bodies to be a certain distance apart from each other. |
TQ3JointType.Magnet | Constrains two bodies, where one is to be the magnet, while the other body is forced towards it in linear velocity by their difference in mass. |
TQ3JointType.Buoyancy | Constrains two bodies to simulate floating bodies, f.e. on water surface. |
Requirements
Collider Prefab
For a working joint between two bodies, each one has to have a rigid body collider registered in the physics system. To do so, simply select your TGorillaPhysicsSystem component in the object inspector move to the “Colliders” property and add a collection item for each element.
Body A attached To Body B
Each joint item provides a ControlA and ControlB property. Those properties need to be set, otherwise the joint will not work. For most of the joint types it is important to connect the bodies in correct relation. If you'd like to create a StiffSpring joint, you need to set the child element into ControlA and the parent, where the spring “hangs”, into ControlB.
Properties
Name | Description |
---|---|
DisplayName | Defines a name to identify the joint by the user. |
Enabled | Activate or deactivate this joint on creation. |
JointType | Define the kind of connection between the two bodies by the TGorillaPhysicsJointType enumeration type: Fixed, BallAndSocket, Hinge, LimitedHinge, Prismatic, StiffSpring, Magnet or Buoyancy |
ControlA | Link the first joint control (CHILD) - this has to have a rigid body collider prefab! |
ControlB | Link the second joint control (PARENT/OWNER) - this has to have a rigid body collider prefab! |
Anchor | Some joint types need an anchor to be defined, f.e. hinge joints. Anchors can be used to define the linking position between two bodies relatively to the parent control (ControlB) |
AntiGravity | For some joint types it's helpful to apply a default anti gravity value, f.e. prismatic joints should stay in vertical position and only react on user input. |
Axis | Some joint types need an axis to be defined, f.e. hinge joints. The axis vector defines how the controls are able to move/rotate around on the basis of the joint. (1, 1, 1) means all directions are allowed, while (0, 1, 0) means, that only the y-axis movement/rotation is allowed |
BreakForce | Define the minimum power where the joint breaks by force. If a joint breaks, it will be deactivated for computation. |
BreakTorque | Define the minimum power where the joint breaks by torque. If a joint breaks, it will be deactivated for computation. |
Damping | Some joint types need a damping value to be defined, f.e. spring joints. |
Stiffness | Some joint types need a stiffness value to be defined, f.e. spring joints. |
RestLength | Some joint types need a rest-length value to be defined, f.e. spring joints. |
MaxValue | Define a maximum limit, f.e. used by prismatic joints |
MinValue | Define a minimum limit, f.e. used by prismatic joints |
Motor | TGorillaPhysicsMotorType: NoMotor, RotationMotor, AngularVelocityMotor, PositionMotor, LinearVelocityMotor, VelocityMotor |
MotorForce | If a motor type was selected, by the motor force value you can control the intensity of the motor computation. |
Motors
Motors allow a joint to compute some automated behaviour during its handling. Sometimes you want to automatically rotate an object around its axis, like a paddle wheels of a ship floating on water by a buoyancy joint.
Type | Description |
---|---|
TGorillaPhysicsMotorType.NoMotor | Motor compuation deactivated. |
TGorillaPhysicsMotorType.RotationMotor | An rotation motor, continuesly applies the motor force value to the quaternion / rotation matrix information for a constant rotation. |
TGorillaPhysicsMotorType.AngularVelocityMotor | An angular motor, continuesly applies the motor force value to the angular velocity value. In case of a still object this will lead to faster and faster rotation. |
TGorillaPhysicsMotorType.PositionMotor | A linear motor, drives towards a position. A motorized prismatic joint that drives toward the specified relative target position. The axis is the direction of motion. |
TGorillaPhysicsMotorType.LinearVelocityMotor | A linear motor, drives towards a velocity. A motorized prismatic joint that drives to a constant target relative velocity. The axis is the direction of motion. |
TGorillaPhysicsMotorType.VelocityMotor | A velocity motor drives towards angular and linear velocity. Use this type of motor f.e. for wheels of cars or paddlewheels of ships. |
Joint Types
Fixed Joint
Constrains two rigid bodies together, removing their ability to act independent of each other.
The joint will try to keep the original distance between the bodies as best as possible. But due to collisions with other colliders it might happen that the fixed connection is getting unconsolidated.
Ball And Socket Joint
Allows motion around an indefinite number of axes. Humans have such joints in the hips and shoulders.
Hinge Joint
Allows free rotation on one axis. Can be used for spinning wheels and carousels.
Limited Hinge Joint
Allows limited articulation on one axis. Humans have such joints in the fingers and knees.
Prismatic Joint
Constrains two bodies to a sliding motion on one axis. Can be used to make various sliding doors.
Stiff Spring Joint
Constrains two bodies to be a certain distance apart from each other.
Magnet Joint
Constrains two bodies, where one is to be the magnet, while the other body is forced towards it in linear velocity by their difference in mass.
Buoyancy Joint
Constrains two bodies to simulate floating bodies, f.e. on water surface.