Collision Tweaking


I’ve noticed something with collisions, particularly an object colliding with a surface like a wall…

Even though I’ve specified the From Object to set itself back to the previous x y position, this does not take well at times. The From Object seems to get stuck on the Into Object.

I know speed has something to do with it; faster moves with the From Object results in that object getting stuck on the Into Object, but it will also happen if the From Object is descending from above, and just so happens to pass through the Into Object a bit as it makes its way to the ground surface. The From Object will hit the ground surface partially inside the Into Object and you guessed it…STUCK!

Is there a away to prevent that “getting stuck” from happening? or Do I have to write a bunch of “safety codes” that’ll push the From Object in place; which would be too much work give the number of walls and directions.

Any help here would be great. I’m currently working on a more commercial quality project. Someone stated in another form that there isn’t enough full games made with Panda3D…well I’m trying to help change that, but I’m still rather new to Panda.

Everything is going good so far…the unclean collision is an issue though.

Just a simple advice. Strictly follow move->traverse->(repos) way for detection of collisions. Its common mistake to repos and move objects before or after traversion.

Everything is in order. I realized where your code is placed is important a long time ago, so everything is move, trav, repos.

I have an idea…a theory. I’m going to see what my IQ can “cook up” and report back.

Implementing a good collision handling algorithm is hard. There are two ways it can go wrong: (a) if your handling is too loose, things can pass through other things, or (b) if your handling is too restrictive, things can get stuck in other things.

Both of these are common problems with collision systems. Since collision detection is not 100% precise, you have to be able to handle a certain amount of imprecision without getting stuck, but not so much that things pass through. It’s a difficult balance, and no collision system solves it perfectly.

The common approach of “when you detect a collision, set your moving object back to where it was before it detected the collision” is particularly likely to introduce stickiness, because you can get into a situation where there is no place you can move that doesn’t detect a collision with something.


I believe I solved the issue. I modified another chunk of code that happens way before the move, trav, repos. Everything seems to look good; my character is not getting stuck anymore…I just hope I don’t get any surprises.

God I hate the technical stuff of game development…that’s why I always start with the tech stuff first, and make graphic finalizing the last thing I do. In fact, I won’t worry about final graphics until the end of the entire project. That’s how much the tech stuff pains.

If only game players knew what a developer had to go through to bring them those hardcore kick “donkey” titles, they would probably criticize a little less often. It’s WORK!!

I’ve been at it for about six months already and I’m sure this project will not get finished until late this year (if it doesn’t flow into early 2012).

I’m actually working on this thing for hours a day.