Skip to content
EvilEngine.Api.Physics

JointSpec record

public sealed record JointSpec

What IPhysicsWorld.Join makes a joint from: the two bodies it joins, and everything else as overrides with defaults. A joint keeps its two pivots together and lets the child turn against the parent about the joint’s X, Y and Z axes, each within its own limits.

var elbow = world.Join(new JointSpec(upperArm, forearm)
{
    Position = forearm.Position,
    Orientation = forearm.Orientation,
    Limits = [new JointLimit(0, 0), new JointLimit(0, 0), new JointLimit(-2.4, 0)]
});
Assembly
EvilEngine.Api
Commit
4ff877b1

Members

JointSpec constructor

public JointSpec(IPhysicsBody Parent, IPhysicsBody Child)

Makes a spec for a joint between parent and child at the origin, free on every axis, with no friction, and the two bodies not colliding with each other.

Parent property

public IPhysicsBody Parent { get; init; }

The body the joint hangs the child from.

Child property

public IPhysicsBody Child { get; init; }

The body that turns against the parent.

Position property

public MapVector Position { get; init; }

Where the joint is in the world, in meters on Godot’s axes, when the bodies are where they are now. Unused when InParent and InChild are both set.

Orientation property

public Orientation Orientation { get; init; }

How the joint’s axes are turned in the world, Identity unless set. Unused, like Position, when both local frames are set.

Limits property

public IReadOnlyList<JointLimit> Limits { get; init; }

How far the child may turn about each of the joint’s X, Y and Z axes, as three JointLimits of a min and a max in radians. JointLimit.Free, -π to π, leaves an axis free, and a limit whose min and max are the same locks it. The child never moves along an axis, only turns.

Friction property

public IReadOnlyList<double> Friction { get; init; }

How hard each axis resists turning, as three numbers. Above 0, the joint holds the child against turning about that axis up to that much torque. Its units aren’t measured against Source’s yet.

Collide property

public bool Collide { get; init; }

Whether the two joined bodies collide with each other, false unless set. Only the joined pair is affected: other bodies, including the rest of a ragdoll, still collide with both.

InParent property

public JointFrame? InParent { get; init; }

The joint’s frame in the parent’s own space, as a JointFrame, or null to work it out from Position and Orientation. A ragdoll sets both local frames from its model’s bind pose, so the pose its parts are spawned in doesn’t become the joints’ zero.

InChild property

public JointFrame? InChild { get; init; }

The joint’s frame in the child’s own space, as InParent is in the parent’s.