This is very, very exciting as is but there are several things I need to implement or improve:
- Code refactoring
- The Fauerby paper actually includes some information on how to implement this, so hopefully it will be easy.
- Broad phase collision detection
- The current implementation runs the rather expensive collision detection algorithm on every object in the scene on every frame. This is fine for a very limited number of objects but I need to implement a broad phase that can quickly eliminate objects that are far away and thus cannot collide with the player. THREE automatically generates an axis aligned bounding box (AABB) for every object in a scene, so checking against those is likely the way to go.
- Spatial partitioning
- In addition to a broad phase, I would like to use something like an octree to further optimize the collision detection system. There are lots of good articles on this concept, but I probably won’t implement this immediately.
There are other things to do but these are the big ones. I’ll probably spend the next several days rewriting the code, then stick in a broad phase check, then put the code into the game. After that I’ll work on gravity, and save octrees for another day.
Overall I’m very excited because a reliable collision detection and response system will allow me to make a basic world that feels interactive. I can then build off that by adding more “game” type features.