Skip to content
EvilEngine.Formats.Collision

Collider record

public sealed record Collider

One shape of a collision: what shape it is, what it’s made of, and where it sits about the collision’s origin.

var lid = new Collider(new ColliderShape.Box(new Vector3(0.8f, 0.05f, 0.8f)), ["solid"])
{
    Position = new Vector3(0, 0.4f, 0)
};
Assembly
EvilEngine.Formats
Commit
4ff877b1

Members

Collider constructor

public Collider(ColliderShape Shape, IReadOnlyList<string> Contents)

Makes a collider of shape and contents at the collision’s origin, unturned and with no name.

Shape property

public ColliderShape Shape { get; init; }

The ColliderShape: a box, sphere, capsule, cylinder, convex hull or triangle mesh. Its Surface says what it’s made of to footsteps, impacts and friction.

Contents property

public IReadOnlyList<string> Contents { get; init; }

What the collider is to things moving through it, as Source’s brush contents are, each a name: solid, window, grate and moveable block everything, while player_clip, npc_clip, vehicle_clip and physics_clip block only players, NPCs, vehicles or props. ladder, water, slime, lava, trigger, debris, detail, translucent, opaque and block_sight are the rest. A collider needs at least one, and only these, to be written. Give a Plugin’s own solid.

The map’s colliders and the models placed in it collide by their contents. A body made through IPhysicsWorld.Add doesn’t read them: it collides as a prop, with the world, physics clip and other props.

Name property

public string? Name { get; init; }

The collider’s name, or null. A Source ragdoll’s colliders take their solid’s name, which is its bone’s.

Position property

public Vector3 Position { get; init; }

Where the collider’s own origin sits from the collision’s, in metres. A box, sphere, capsule or cylinder is centred on it, and a hull’s or mesh’s points are about it. A jointed collision’s colliders sit where they are in the model’s own bind pose, not about their body.

Rotation property

public Quaternion Rotation { get; init; }

How the collider is turned about its own origin, as a System.Numerics.Quaternion. Identity unless set. A capsule or cylinder runs along its own Y axis, so turn it to lie another way.