Open michalbe opened 6 years ago
The Transform
component should only store the information about the position and the rotation of the center of the entity and its scale. In particular it shouldn't know anything about the bounds of the entity.
The Render
component has the information about the bounds via vertices
but using that for the physics engine is likely an overkill in most cases. I suggest adding a Collider
component with a type, or perhaps a few different collider components: BoxCollider
, SphereColiider
etc.
Right now cervus uses only the
box
collider in theRigidBody
component (PR #118), but @chandlerprall's GoblinPhysics engine (the one we're using in ourrb
) has a built in support for eight different shapes. I feel likenew physics.colliders[this.shape]
call incomponents/rigid_body
should pass entity'sTransform
component to the constructor, and all the magic (with different shapes expecting different arguments) should happen inside thephysics
module.