Implement better collision code
There are enough objects in the world now that it seems reasonable to start looking at collision code.
The current collision code is very barebones and was written to only stop the player from going through walls (more precisely: non-air voxels).
To do:
- [ ] Player collider (ideally a capsule since they need to be able to walk onto raised platforms)
- [ ] Jumping
- [ ] Falling
- [ ] Colliders for every VoxelDataType (walls, raised platforms, diagonals, chasms, etc.)
- [ ] Entity colliders (probably cylinders because their vertical position never changes)
At this point I don't want to mimic the original game's physics exactly since it seems kind of funky, like being magnetically pulled to the center of a voxel when falling into a pit. Will re-evaluate once better collision code is in.
Places of note:
- Player::onGround()
- Player::handleCollision()
- Player::updatePhysics()
- EntityManager::getEntities() for collision testing
- VoxelGrid::getVoxel() + getVoxelData() for collision testing
- LevelData getter functions for entity manager and voxel grid
Evaluating bringing Jolt Physics into the engine soon. That should handle most of these things eventually.
Merged Jolt Physics integration. Far from perfect atm but it's enough for testing the game.