Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have trouble while detecting collisions on my 3D-Game.

I have set-up Rays, to detect collisions (Screenshot) and my main-rountine already analyzes them. But now there's the question what to do with that.

One possibility would be, to move the player back to the last position, but that's dirty, and does not work if the player can walk in multiple directions (e.g. if the player runs along a wall).

My question is, what to do with the collision data / or in which direction, by which amount move the player? I'm sure there is an algorithm for that (as for almost all is).

share|improve this question

migrated from Nov 27 '12 at 14:39

This question came from our site for professional and enthusiast programmers.

up vote 1 down vote accepted

I guess you're going the right way, but there's more to that than you imagine. Collision detection is a vast research topic (GAMMA).

From Wikipedia:

"(...) physical simulators usually function one of two ways, where the collision is detected a posteriori (after the collision occurs) or a priori (before the collision occurs). In addition to the a posteriori and a priori distinction, almost all modern collision detection algorithms are broken into a hierarchy of algorithms. Often the terms "discrete" and "continuous" are used rather than a posteriori and a priori."

And it follows as this:

"In the a posteriori case, we advance the physical simulation by a small time step, then check if any objects are intersecting, (...) and the positions and trajectories of these objects are somehow "fixed" to account for the collision."

"In the a priori methods, we write a collision detection algorithm which will be able to predict very precisely the trajectories of the physical bodies (...) and the physical bodies never actually interpenetrate (...)"

Where to begin:

From my experience, I read a long time ago David Eberly's "3d Game Engine Design" book, which has a chapter on the subject that ends with a simple collision detection system implementation. I think it is a very adequate starting source, due to the fact you're trying to build a game engine.

Another way to go would be reading this very well recomended book (Real-time collision detection).

In addition, a quick google search on "collision detection state of art" led me to this paper.

It's from 2005 but looks ok, at least to me.

Hope this helps,


share|improve this answer
Thank you very much for all these information (; I'll read through and propably buy the books (; – tobspr Nov 28 '12 at 13:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.