Archived

This topic is now archived and is closed to further replies.

MichaelNolan

How do you set your collision?

Recommended Posts

MichaelNolan    122
Hi, 1. How are ya? 2. How would you set-up accurate collision-detection? I used collision boxes for each polygon but i still kept going right through the objects. Any segestions? Regards, Michael

Share this post


Link to post
Share on other sites
Vich    142
Here are some possibilities:

- Check every polygon for collision
- Find the bounding box around a group of polygons and check only the box for collision
- Do the same as before but with spheres instead of boxes

I would recommend one of the last two.

"My basic needs in life are food, love and a C++ compiler"
[Project AlterNova] [Novanet]

Share this post


Link to post
Share on other sites
RPGamer    122
You really shouldnt just use one collision engine at all times. There are times when plain old object bound box collision is fine, and other times when more precise math based collision is needed.

Poly-Poly collision tends to be slower, as there are more checks being made, and often problems arise. Id go with what Vich says, and avoid it, most the time.

If your talking about walking about a city, box collision can usually do. If you have a more unique shape to a building, spherical bound objects can sometimes work. If the object is simply too complex to bind with multiple boxes/spheres, it may be time for maths. Mathematically calculate the areas of the object that are on the surface, and perform checks compairing that to the players position. If the player is at those cordinates, run your collision sequence.

RPGamer

Share this post


Link to post
Share on other sites
Waverider    169
For now I try to calculate the accurate point and time of impact and apply the collision effects. In some cases this means I have to detect for the first collision that occurs, move everything up to that point, apply the collision, and continue. The benefit is that I don't have to worry about pauses in the framerate, causing a lot of elapsed time, resulting in objects passing through each other before I can determine that they have collided.

I have to be careful how often I do this, though. It can easily lead to redundant calculations. Many gaming situations don't require such accurate detection, either.

[edited by - Waverider on January 4, 2004 6:21:40 PM]

Share this post


Link to post
Share on other sites