Page 1 of 1

3D:Boxcollision or Trianglecollision, what is better?

Posted: Sun Aug 01, 2004 9:09 am
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?

Posted: Sun Aug 01, 2004 1:41 pm
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...

Posted: Sun Aug 01, 2004 3:09 pm
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.

Posted: Mon Aug 02, 2004 8:14 am
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.