Question

I have a big array of voxels, a la Minecraft. The player/enemies are in this grid. I have no idea how to go about doing this type of collision detection. Note, this is NOT dynamic movable object vs. dynamic movable object, this is movable object vs. stationary ground/wall/ceiling.

I have no problem with detection, its the response that I do not know how to do.

What I have to work with: Player position, velocity, and boundingbox, and a array of 1x1x1 voxels surrounding the player.

Was it helpful?

Solution

  • Calculate the dot product of the player's velocity and the unit surface normal of the colliding voxel (pointing outward).
  • Scale (multiply) the unit surface normal by this value.
  • Subtract your result from the player's velocity.

This will give you the "slide against the wall" effect that most games employ (without any problematic trigonometry)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top