cervus icon indicating copy to clipboard operation
cervus copied to clipboard

Different collider shapes

Open michalbe opened this issue 7 years ago • 1 comments

Right now cervus uses only the box collider in the RigidBody component (PR #118), but @chandlerprall's GoblinPhysics engine (the one we're using in our rb) has a built in support for eight different shapes. I feel like new physics.colliders[this.shape] call in components/rigid_body should pass entity's Transform component to the constructor, and all the magic (with different shapes expecting different arguments) should happen inside the physics module.

michalbe avatar Oct 25 '17 01:10 michalbe

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.

stasm avatar Oct 25 '17 08:10 stasm