PDA

View Full Version : Humvee driver with collision detection


davidghemer
11-30-2011, 09:30 PM
The attached world lets you drive a Humvee around. I've included two kinds of collision detection. One is for circular objects where the distance to function is used.
The second is for rectangular objects where I use a combination of is right of, is left of etc functions and distance to left, distance to right etc.

This works reasonably well. I still get some false collisions on corners - probably because of the fact I use half the Humvee depth as my threshold.

It also (very) occasionally drives into walls.

Other than that it seems to work fairly well.

Mr Kidnapper
11-30-2011, 10:47 PM
It works well. The only cases it doesn't work is when running into corners. It also doesn't work on odd shaped objects. You would have to tailor your objects towards your collision for it to work. For example, the windmill is a bit odd because the blades end up increasing the "radius" of the object by being an extending part of the windmill. This would be fixed by separating the extending part from the object and placing it on the same hierarchy level, but that would be silly. The house with the steps is odd in that the steps are the extending part. If you separated the steps and placed them on the same level, then it would allow for more complex collision.