Can someone explain collision details?
by Josh Albrecht · in Torque Game Engine · 12/23/2001 (8:55 pm) · 10 replies
All I know is that they are pieces of a mesh used for collision. I have a few questions about them:
1. Can they be any shape?
2. Can they be assigned to a node?
3. Will they animate with that node?
4. In the code, how are they represented?
5. If they are animated, where does it occur?
6. Where are they used for collision? I didnt see anything in projectiles.cc....
7. Is there any way to identify a specific detail in the code?
I know this is pretty dam specific, but I would really appreciate any help. I was looking through the code for quite a while, but I wasnt able to answer those questions... :(
Thanks in advance!
1. Can they be any shape?
2. Can they be assigned to a node?
3. Will they animate with that node?
4. In the code, how are they represented?
5. If they are animated, where does it occur?
6. Where are they used for collision? I didnt see anything in projectiles.cc....
7. Is there any way to identify a specific detail in the code?
I know this is pretty dam specific, but I would really appreciate any help. I was looking through the code for quite a while, but I wasnt able to answer those questions... :(
Thanks in advance!
#2
My team has some vehicles with collision shapes. Depending on how we configure them, it seems that one of two things occur:
1. The player can stand on them and it collides properly with terrain. Weapons fire goes straight through.
2. Weapons fire works perfectly. Collision with the terrain is only with the main hull (the wings go through), and the player also falls through.
It seems that no matter what we do, we can't have the best of both worlds. Any helpful hints would be appreciated...
12/24/2001 (11:20 am)
Alright, adding to the confusion today...My team has some vehicles with collision shapes. Depending on how we configure them, it seems that one of two things occur:
1. The player can stand on them and it collides properly with terrain. Weapons fire goes straight through.
2. Weapons fire works perfectly. Collision with the terrain is only with the main hull (the wings go through), and the player also falls through.
It seems that no matter what we do, we can't have the best of both worlds. Any helpful hints would be appreciated...
#3
Does the default player.dts have any collision details? It didnt seem like it to me... I put a breakpoint in the castRay function you pointed out, and it never got called when I shot my bots, even though the bots died...
12/24/2001 (11:59 am)
Thanks Tim! :) It helped alot.Does the default player.dts have any collision details? It didnt seem like it to me... I put a breakpoint in the castRay function you pointed out, and it never got called when I shot my bots, even though the bots died...
#4
I would start with very basic convex shapes (like cubes) to make sure everything is working, then work your way up from there.
12/28/2001 (9:33 am)
James, what do you mean by "how we configure them"? What changes are you making? The biggest thing to watch out for is that they must be convex. If they aren't, wierd things can happen.I would start with very basic convex shapes (like cubes) to make sure everything is working, then work your way up from there.
#5
By configuration, I mean the detail levels the parts are assigned, as well as the number and shape of meshes. The T2 Shrike apparently has its collision shapes configured with the main hull as -1, and the left and right wings at -2 and -3. We tried that configuration at first and found that the wings would not collide with the terrain (only the main hull would), the same for projectiles. Putting them all on the -1 detail level seemed to make it work better with the terrain, but projectiles would pass right through it.
This is what the very basic collision meshes looked like (in white).

Further examination in debug mode showed a mess of polygons that make up the convex below the craft. Apparently, this has to do with the orientation and location of the pivot points for the meshes, as our artist was able to reorganize it a bit after lots of trial and error.

Contrast this with the way the Shrike looks.

Somewhere along the line, it's getting messed up.
12/28/2001 (9:12 pm)
The shapes are all convex. We've tried it with both simple boxes and more complex shapes. There are only a few collision meshes, so we're still within those limits, too.By configuration, I mean the detail levels the parts are assigned, as well as the number and shape of meshes. The T2 Shrike apparently has its collision shapes configured with the main hull as -1, and the left and right wings at -2 and -3. We tried that configuration at first and found that the wings would not collide with the terrain (only the main hull would), the same for projectiles. Putting them all on the -1 detail level seemed to make it work better with the terrain, but projectiles would pass right through it.
This is what the very basic collision meshes looked like (in white).

Further examination in debug mode showed a mess of polygons that make up the convex below the craft. Apparently, this has to do with the orientation and location of the pivot points for the meshes, as our artist was able to reorganize it a bit after lots of trial and error.

Contrast this with the way the Shrike looks.

Somewhere along the line, it's getting messed up.
#6
01/01/2002 (11:07 am)
From what I remember, collision meshes are not assigned to detail levels. The "-1", "-2" is basically ignored by the exporter. The collision meshes must be named in order: "Collision-1", "Collision-2", "Collision-3", "Collision-4", etc.
#7
01/01/2002 (12:53 pm)
Negative detail levels are collision details... Collision-1, as opposed to Collision1.
#8
By putting them all in one "detail" you were getting some response from the terrain, but since you no longer had a single convex mesh, both the terrain and line tests will ultimately fail.
In the example image you have ubove, you'll have to have a single convex mesh which won't quite be optimal :(
01/01/2002 (6:16 pm)
Looking through the code.... the vehicle collision only supports a single mesh. The vehicle only grabs the first collision mesh to work with, though the LOS (and line) tests will test against all meshes.By putting them all in one "detail" you were getting some response from the terrain, but since you no longer had a single convex mesh, both the terrain and line tests will ultimately fail.
In the example image you have ubove, you'll have to have a single convex mesh which won't quite be optimal :(
#9
01/02/2002 (1:37 pm)
Along these same lines, what is the vehicle_collision brush entity in maps used for?
#10
01/02/2002 (3:44 pm)
I believe one of the bottle necks in the engine was the convex hull collisions with interiors. Apparently the complexity of some the interiors was a little too much for the collision engine. The vehicle_collision brushes are used as a sort of low-detail collision mesh for interiors. This was all put in after I left, so I'm not up to speed on how they are setup in WC.
Torque Owner Tim Gift
2. Yes, they can.
3. They will animate.
4. ? Not sure what your asking.
5. All animation is performed by the TS library.
6. Projectiles use the container LOS test, which will eventually test the line against objects in the world. The line->shape intersection code is in the TS library: ts/tsCollision.cc, check out the castRay() method.
7. I don't beleive the TS intersection tests tells you which collision mesh was hit. It obviously has that information, I just don't think it's returning it right now.