This week I’ve been experimenting with controlling physics, here’s what I’ve come up with.
First you make your motion controller class and implement Simulate
public class ThrusterMotion : PhysicsMotionController
{
protected override void Simulate(ref Vector3 linearVelocity)
{
linearVelocity = Vector3.Forward * 10000.0f;
}
}
Then you can attach entities to the motion controller.
var motion = new ThrusterMotion();
motion.AttachEntity(ent);
Right now you can only apply linear forces but internally this is what physgun etc use so ideally you’d be also able to use this class to apply constraints to pick up objects.
This isn’t set in stone or how it’s going to end up but it’s the first pass at dealing with applying forces to objects.