3D:Boxcollision or Trianglecollision, what is better?

Advanced game related topics

Boxcollision or Trianglecollision, what is better? [READ THE POST FIRST]

BoundingBox-Collision
5
19%
BoundingBox-Collision
5
19%
Triangle-Collision
8
31%
Triangle-Collision
8
31%
 
Total votes: 26

DarkDragon
Addict
Addict
Posts: 2348
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

3D:Boxcollision or Trianglecollision, what is better?

Post by DarkDragon »

Hello,

what do you think is better, a really fast boxcollision(you can fake a good collision like a octree collision) or a slow trianglecollision?
bye,
Daniel
Moonshine
Enthusiast
Enthusiast
Posts: 263
Joined: Tue May 25, 2004 12:13 am
Location: UK

Post by Moonshine »

Both. It really depends on the situation. For example, a car could do fine with a box for collision, but a wall would need accurate triangle collision for bulletholes etc. Id use box collision more, but only if they can be rotated, so you could have a box for each limb on the body, lower arm, upper arm, head etc...
Mark my words, when you least expect it, your uppance will come...
Codemonger
Enthusiast
Enthusiast
Posts: 384
Joined: Sat May 24, 2003 8:02 pm
Location: Canada
Contact:

Post by Codemonger »

Moonshine is right. It depends on the situation. But really the fastest and most accurate collision is go continue to go deeper after the first collision returns true, and so on. So you could do a fast sphere collision, then if that returns true do a box collision and then if that returns true then do a triangle collision. This would be (depending on a generic situation) be the most efficient collsion detection.

Also an Octree can be used in different ways, it could either hold instances of meshes for dynamic objects and such ... or it could hold polygons, and have a minimum amount of polygons per leaf node. Or it could hold both and be a hybrid. Also their are loose octree's which are good for dynamic data, because one of the problem with octrees is you assume that as soon as an object moves then it has to discard the node it is in (if empty) and this causes a lot of delay (saves on memory at the expense of speed) . So a loose octree basically just makes each node double it's size from the center of the node or half of the width added to each side of the node. So when objects move, the won't change their node right away and that means less discarding of empty nodes or recreating nodes.
<br>"I deliver Justice, not Mercy"

    - Codemonger, 2004 A.D.
DarkDragon
Addict
Addict
Posts: 2348
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Post by DarkDragon »

Uhm my triangle collision works with a box-collision, but it is also very slow, when the box is reached. I made the triangle-rotation visible, because I had a fault in my code. So I repaired it, and it seems to be ok, but when I turned the boxcollision off the collision-check was wrong. The block I moved stops too early. And then there was a scaling problem:
I must rotate first and scale then. So it was a bit weird. I wanted to repair this fault, but it doesn't work. Now I changed to box-collision to find some more faults. Maybe I'll get back to the trianglecollision when I found the bugs.
bye,
Daniel
Post Reply