Collision detection by sliding against a plane in XNA

Posted by Bevin on Stack Overflow See other posts from Stack Overflow or by Bevin
Published on 2011-01-14T18:51:52Z Indexed on 2011/01/14 18:53 UTC
Read the original article Hit count: 231

Filed under:
|
|

Hello, I am attempting to engineer a collision detection algorithm for a custom Minecraft client I'm making. Basically, the entire world is made up of cubes, and the player (or camera) needs to be able to stand on and move against these cubes. The result I want is illustrated in this image: image

The green line is the player's movement vector. When the player is brushing up against a plane of one of the cubes, I want the vector to change to one that is perpendicular with the plane. The vector should, however, keep all of it's velocity in the plane's direction, yet lose all velocity towards the plane.

I hope I've made my question clear. What is the best and most efficient way to implement a collision detection system like this? Also, will a system like this allow for a simple gravity component?

© Stack Overflow or respective owner

Related posts about c#

Related posts about XNA