vkmEngine 1.0.0
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
Vkm::Engine::Joint Struct Reference

Ties this entity's body to another, at a point on each. More...

#include <joint.h>

Public Attributes

EntityId connected {}
 The other body; empty, or this entity, disables.
glm::vec3 anchor = {0.0f, 0.0f, 0.0f}
 On this body, local.
glm::vec3 connectedAnchor = {0.0f, 0.0f, 0.0f}
 On the other, local.
float distance = -1.0f
 Distance the anchors are held at, in metres, for a Distance joint.
float resolvedDistance = -1.0f
 The length actually held, once the solver has measured it; runtime, not serialized.
float stiffness = 1.0f
 How hard the joint pulls drifted anchors back together, 0 to 1.
float holdTorque = 0.0f
 Most torque, in newton-metres, spent holding the two bodies at the angle between them.
glm::quat heldRotation = {1.0f, 0.0f, 0.0f, 0.0f}
 The angle held, the connected body's rotation in this one's frame; runtime, not serialized.
bool heldResolved = false
 Whether heldRotation is current; cleared while neither body can move. Runtime.
bool collideConnected = false
 Whether the two bodies still collide.

Detailed Description

Ties this entity's body to another, at a point on each.

A constraint, solved in the contact passes - each joint just before the contacts, so a surface has the last word - so a jointed body stacks, sleeps and rests like any other. Anchors are in each body's own frame. A connected entity with no Rigidbody holds the body to a fixed point in the world.

Member Data Documentation

◆ distance

float Vkm::Engine::Joint::distance = -1.0f

Distance the anchors are held at, in metres, for a Distance joint.

Negative means "whatever they were when the joint was made", resolved on the first tick.

◆ resolvedDistance

float Vkm::Engine::Joint::resolvedDistance = -1.0f

The length actually held, once the solver has measured it; runtime, not serialized.

Keeps distance as authored, including a negative that asks for a measurement.

◆ stiffness

float Vkm::Engine::Joint::stiffness = 1.0f

How hard the joint pulls drifted anchors back together, 0 to 1.

Scales the target the solver converges on, not a spring constant or each pass's impulse, so it cannot be tuned into instability or change meaning with the iteration count. At 1 drift closes overdamped, at the joint spring's full rate; at 0 relative motion is still held but drift is left.

◆ holdTorque

float Vkm::Engine::Joint::holdTorque = 0.0f

Most torque, in newton-metres, spent holding the two bodies at the angle between them.

The angle is the one they had when the joint last began to move them: the pose a ragdoll had when it went live. A load that needs more than this turns the joint, so a held limb sags under a weight it cannot carry rather than snapping back. 0 leaves the rotation free.


The documentation for this struct was generated from the following file: