This document is about: QUANTUM 3
SWITCH TO

Physics Joints

Introduction

A physics joint is a connection between physics bodies that restricts movement. They are valuable in games as they allow for realistic movement, interaction between physics bodies, and vehicle simulations.

Configuration

Quantum's physics joint API provides several parameters that can be used to modify their behavior.

Field Description
Start Disabled Whether or not the joint should start disabled. Disabled joints will be ignored by the physics systems.
Type What type the joint should be.
User Tag A numerical tag that can be used to define groups of joints.
Connected Entity What entity this joint is connected to. This entity MUST have a transform component.
Connected Anchor The anchor point of where the joint entity connects to. If there is no connected entity, this will be in world space, otherwise it will be in local space.
Anchor The anchor offset in local space of the joint entity's transform.
Axis The axis around which the joint rotates. If set to zero, FPVector3.Right is used instead.
Use Angle Limits If the angle between the joint's transform and its anchor should be limited by the hinge joint. Only relevant if the joint is a hinge joint.
Lower Angle The lower limiting angle of the arc of rotation around the anchor, in degrees.
Upper Angle The upper limiting angle of the arc of rotation around the anchor, in degrees.
Use Motor If the hinge joint should use a motor. Only relevant if the joint is a hinge joint.
Motor Speed The speed at which the motor will attempt to rotate, in degrees per second.
Max Motor Torque The maximum torque the hinge joint can provide, if set to 0 then it will not be limited.

Hinge Joints

A Hinge Joint connects two physics bodies together at a point, allowing them to rotate around a specified axis. These joints can be useful for creating doors, gates or rotating obstacles. Hinge Joints also have optional motors which will constantly try to rotate in a specified direction. To use a motor in the hinge joint, set UseMotor to true in the joint component.

Spring Joints

A Spring Joint keeps bodies apart and maintains a separation between them, but allows some stretching in the distance between them. They can be useful for creating complex character movement or environment interactions like bridges that respond to player movement.

Distance Joints

A Distance Joint is a type of physics joint used to maintain a fixed distance between two objects. It restricts the relative motion of the connected objects along a straight line, keeping them at a specific distance from each other. This joint type is useful for simulating rigid connections, such as ropes and virtual springs. Generally useful for any joint where the distance between the objects remains constant. It allows for realistic interactions, stability, and control over connected objects in the simulation.

Character Joints (3D)

In 3D Physics, a Character Joint constrains the relative rotation of two connected rigid bodies around a shared anchor point. It is an extension of the ball-and-socket joint and is particularly useful for building complex ragdolls for humanoid characters and creatures.

This joint uses three axes to constrain the relative rotation between the two bodies. The Twist Axis usually points along the bone, and rotation around it twists the limb. The Swing Axis (the first swing axis) is the axis around which the limb bends. The second swing axis is calculated automatically as the cross product of the Twist Axis and the Swing Axis. Keep the Twist Axis and the Swing Axis perpendicular to each other, since the joint does not correct non-perpendicular axes.

All angle limits are relative to the orientation of the two bodies when the joint is created.

Field Description
Twist Axis The axis along the bone, in the local space of the joint entity. If both axes are zero, FPVector3.Right is used. If only this axis is zero, it is calculated perpendicular to the Swing Axis.
Swing Axis The first swing axis, in the local space of the joint entity. If it is zero, it is calculated perpendicular to the Twist Axis.
Use Twist Angle Limits Enables the angle limits around the twist axis. If disabled, rotation around this axis is unrestricted.
Twist Lower Angle The lower twist limit, in degrees. It is clamped between -177 and 0.
Twist Upper Angle The upper twist limit, in degrees. It is clamped between 0 and 177.
Swing 1 Angle Limits The symmetric limit around the first swing axis, in degrees: a value of X allows rotation from -X to +X. It is clamped between 0 and 177. A value of 0 locks this axis. If unset, rotation around this axis is unrestricted.
Swing 2 Angle Limits The symmetric limit around the second swing axis, in degrees: a value of X allows rotation from -X to +X. It is clamped between 0 and 177. A value of 0 locks this axis. If unset, rotation around this axis is unrestricted.

But there's no rule specifying which axis to use, and you can use the twist or swing values to constrain rotation around any axis. Just set the direction that works best for you.

Creating a Simple Knee Joint

  1. Set the Connected Anchor and Anchor properties so that both anchors coincide.
  2. Set the Twist Axis direction to (0, 0, 1). You can use a different direction if necessary.
  3. Enable Use Twist Angle Limits and set Twist Lower Angle to -90 degrees and Twist Upper Angle to 0 degrees.
  4. Set both Swing 1 Angle Limits and Swing 2 Angle Limits to 0 degrees.

Creating a Simple Limb Joint

  1. Set the Connected Anchor and Anchor properties so that both anchors coincide.
  2. Set the Twist Axis direction to (0, 1, 0) and the Swing Axis direction to (1, 0, 0).
  3. Set both Swing 1 Angle Limits and Swing 2 Angle Limits to 90 degrees.

Check how to setup a Quantum Ragdoll.

Last updated on

Back to top