# JointSpec record

> 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.

Namespace `EvilEngine.Api.Physics`, assembly `EvilEngine.Api`. Engine commit 4ff877b1.

```csharp
public sealed record JointSpec
```

What [IPhysicsWorld.Join](/docs/api/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.

```csharp
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)]
});
```

## Members

### JointSpec (constructor)

```csharp
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)

```csharp
public IPhysicsBody Parent { get; init; }
```

The body the joint hangs the child from.

### Child (property)

```csharp
public IPhysicsBody Child { get; init; }
```

The body that turns against the parent.

### Position (property)

```csharp
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](#inparent) and [InChild](#inchild) are both set.

### Orientation (property)

```csharp
public Orientation Orientation { get; init; }
```

How the joint's axes are turned in the world, [Identity](/docs/api/orientation#identity) unless set. Unused, like [Position](#position), when both local frames are set.

### Limits (property)

```csharp
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 `JointLimit`s 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)

```csharp
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)

```csharp
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)

```csharp
public JointFrame? InParent { get; init; }
```

The joint's frame in the parent's own space, as a [JointFrame](/docs/api/jointframe), or `null` to work it out from [Position](#position) and [Orientation](#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)

```csharp
public JointFrame? InChild { get; init; }
```

The joint's frame in the child's own space, as [InParent](#inparent) is in the parent's.
