Collisions with static objects
by John Carroll · in Torque Game Engine Advanced · 04/04/2007 (8:33 am) · 3 replies
Hi, we seem to be having a problem with collision detection with projectiles and static objects. We have a static object that looks like this:
1-5 Represent the collision meshes for this object, and X is where the projectile is. The engine is detecting a collision in this case, reporting that we hit both meshes 4 and 5. Why is this happening? Is there a bug in the collision detection code? I have craweled through the buildConvexHull routine, and don't see anything obviously wrong. Any clues as to what's going on here will be greatly appreciated. Thanks!
/''''''''''\
| 1 |
|-----------|
| 2 | X
|-----------|
/ 3 \
/''''''''''''---------------- '''''''''''''\
| |
| |
| |
| |
| 4 |
| |
| |
| |
|------------------------------------------|
| |
| |
| 5 |
| |
| |
-------------------------------------------1-5 Represent the collision meshes for this object, and X is where the projectile is. The engine is detecting a collision in this case, reporting that we hit both meshes 4 and 5. Why is this happening? Is there a bug in the collision detection code? I have craweled through the buildConvexHull routine, and don't see anything obviously wrong. Any clues as to what's going on here will be greatly appreciated. Thanks!
About the author
Working on using Torque as an Image Generator for Tactical Simulations under laser and live fire conditions, for Law Enforcement/Military applications.
#2
04/04/2007 (2:48 pm)
I suspect that's exactly what's happening. Apparently, the engine will realize that there aren't any LOSCOL meshes, and creates them from the collision meshes. Either way, I've tried with and without LOSCOL meshes, to no avail. These are StaticShape based objects. It appears that buildConvexHull checks each collision mesh and realizes that it doesn't hit mesh's 1-3, but returns a hit on mesh's 4 and 5. I'm thinking that there may be something wrong with buildConvexHull, since collision mesh's 1-3 behave as expected. Colliding with the bounding box sounds like what's happening, yet I get a call to buildConvexHull for each and every collision mesh. So, to me anyway, it doesn't look like it's aggregating meshes (and using a bounding box), but rather checking each collision mesh for a collision, which leads me to believe that it's not building the convex hulls correctly. I am continuing to explore this code.
#3
04/09/2007 (4:22 pm)
I've found that there's a problem with the collision detection. It appears that if an object is too thin, collision detection basically punts (or the algo fails) and uses the bounding box. Our object was quite thin, and when I made it much thicker, collision detection began working properly. I will give more details in the bug forum.
Torque 3D Owner Phil Carlisle
Actually, now I think about it, youre talking about static objects, do you mean TSSTatic or StaticShape based objects?
Have you checked to see its not colliding with the bounding box?