# CollisionJoint record

> A joint between two parts of a jointed collision, as a Source .phy's ragdollconstraint gives one. It keeps the two together at its pivot and lets the child turn against the parent about the joint's X, Y and Z axes, each within its own limit. A ragdoll's joints become JointSpecs with these limits and friction, and the parts they join don't collide with each other.

Namespace `EvilEngine.Formats.Collision`, assembly `EvilEngine.Formats`. Engine commit 4ff877b1.

```csharp
public sealed record CollisionJoint
```

A joint between two [parts](/docs/api/collisionbody) of a jointed [collision](/docs/api/collisioncontent), as a Source `.phy`'s `ragdollconstraint` gives one. It keeps the two together at its pivot and lets the child turn against the parent about the joint's X, Y and Z axes, each within its own [limit](/docs/api/jointlimit). A ragdoll's joints become [JointSpec](/docs/api/jointspec)s with these limits and friction, and the parts they join don't collide with each other.

```csharp
var elbow = new CollisionJoint(1, 2)
{
    Position = new Vector3(0.3f, 1.4f, 0),
    Limits = [new JointLimit(0, 0), new JointLimit(0, 0), new JointLimit(-2.4, 0)]
};
```

## Members

### CollisionJoint (constructor)

```csharp
public CollisionJoint(int Parent, int Child)
```

Makes a joint from part `parent` to part `child`, by their index in [Bodies](/docs/api/collisioncontent#bodies), at the model's origin, free on every axis and with no friction.

### Parent (property)

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

The index of the part the joint hangs the child from. It must be another part than [Child](#child) for the collision to be written.

### Child (property)

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

The index of the part that turns against the parent.

### Position (property)

```csharp
public Vector3 Position { get; init; }
```

Where the joint's pivot is in the model's bind pose, in metres. A `.phy` joint's is its child's bone.

### Rotation (property)

```csharp
public Quaternion Rotation { get; init; }
```

How the joint's axes are turned in the bind pose, as a `System.Numerics.Quaternion`. Identity unless 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, three [JointLimit](/docs/api/jointlimit)s in radians, all [Free](/docs/api/jointlimit#free) unless set. It must be exactly three for the collision to be written. A `.phy` constraint's `xmin` to `zmax` are degrees, turned to radians and kept within -π to π.

### Friction (property)

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

How hard each axis resists turning, as three numbers 0 or above, all 0 unless set. Above 0, the joint holds the child against turning about that axis up to that much torque. A `.phy` constraint's `xfriction`, `yfriction` and `zfriction`.
