CollisionContent record
public sealed record CollisionContent Converted collision content: the shapes something collides with, and what it weighs. A model’s is <model>/collision, made from Source’s .phy for Garry’s Mod, and a Plugin makes its own to give BodySpec for IPhysicsWorld.Add. Every length is in metres on Godot’s axes, about the body’s origin.
A box crate and a ball, each one Collider:
using System.Numerics;
using EvilEngine.Api.Physics;
using EvilEngine.Formats.Collision;
using EvilEngine.Formats.Maps;
var crate = new CollisionContent([new Collider(new ColliderShape.Box(new Vector3(0.8f, 0.8f, 0.8f)), ["solid"])]);
var ball = new CollisionContent([new Collider(new ColliderShape.Sphere(0.25f), ["solid"])])
{
Motion = new CollisionMotion { Mass = 2 }
};
context.Physics?.Add(new BodySpec(crate) { Position = new MapVector(0, 2, 0), Mass = 30 });
context.Physics?.Add(new BodySpec(ball) { Position = new MapVector(1, 2, 0) });
A collision of several colliders is one rigid body of all of them, each placed by its own Position and Rotation. A dynamic body takes only convex shapes, so one holding a Mesh can only be static or kinematic.
- Assembly
- EvilEngine.Formats
- Commit
- 4ff877b1