So I’m implementing AABB collision detection into my voxel game (Think Minecraft, but with smaller voxels).
Right now, I check to see if the player is moving in a certain direction, and if it is, I check that face of the AABB for collisions against the voxel terrain (So if the player X velocity is > 0, I check the right side of the player’s AABB, which improves performance). I have a 3D array of bytes, which I can index at a 3D coordinate to see if that voxel is solid or not
If that face did collide, I slide the player along the colliding voxel. I obtain the normal for the colliding voxel face easily, its just the opposite of the normal of the player AABB face I was checking.
This works fine, except for 1 bug. Lets say the Front face of the player’s AABB was colliding with a wall of voxels. The corner of the front face and the left is naturally also colliding. However, that means when I check the left face for collisions, it will also check that corner, and think there is a collision on the left face! The same happens with the bottom face. Lets say I run up against a wall of voxels, and the front face of the player’s AABB is colliding, the seam where the front face meets the bottom face is colliding. Therefor, when I check the bottom face for collisions, it thinks the player is hitting the ground :-.
Here are some example images in case you need more clarification: https://www.dropbox.com/s/iq7fo1qipps6sss/Side.png?dl=0, https://www.dropbox.com/s/trbw17j9ucmov9e/Top%20Down.png?dl=0
I feel like the answer to this is probably pretty simple, and I’m just completely missing it, however I’ve been trying to work something out for days, and I just cant come up with anything.
Thanks a lot for your help. JGO is a wonderful community