Hello. So I’ve noticed that CollisionShapes in the engine are centered at the origin. Should our models be as well? So this doesn’t happen:
Or should we just offset the CollisionShapes? If so what is the best way to do this? I’ve seen a method that uses CompoundCollisionShape but I don’t know how I feel about that.
I decided to add an optional vec3 Offset to CollisionShape. That gets applied to the PositionComponent after physics update like this:
PositionComponent p = e.get(PositionComponent.class);
CollisionShapeComponent c = e.get(CollisionShapeComponent.class);
rigidBody.getPhysicsRotation(p.getRotation());
rigidBody.getPhysicsLocation(p.getPosition()).subtractLocal(p.getRotation().mult(c.getOffset()));