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.
Yes, I think that’s right. Or stick them under a node to center them and let the collision shape go with the node.
…but on some level collision shapes will always be based on the center of gravity.
The performance hit for adding them into another node is negligible right? There is more matrix multiplication involved?
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()));
Felt better than adding to a node to center.