Game Development Community

Multiple Collision Meshes On a Single Object in Torque 3d

by Michael Stoll · in Artist Corner · 10/04/2012 (8:51 pm) · 19 replies

How is this handled? I understand that we aren't permitted to have concave shapes in our collision meshes, so then the way to do a complicated collision mesh would be to have many convex shapes. How should I go about doing this? I tried adding in multiple collision objects (Col-01, Col-02, Col-03...etc) into the DAE, but the collision editor in the editor seems to only allow one of these?

Help!

#1
10/04/2012 (9:24 pm)
Micheal,

From the online docs:

Collision detail levels must be named Collision-X, X is a number from 1 to 8 for collision meshes.

It's all covered pretty well here: docs.garagegames.com/torque-3d/official/index.html?content/documentation/Artist%...
#2
10/04/2012 (10:00 pm)
I read through something similar (although thank you for the resource- the one I was referencing was out-of-date) previously, but I'm still unsure of the process for more complicated Collision Meshes.

In a situation where an object cannot have a collision from just one convex shape (ie a building with an interior and exterior) how would I proceed with that?

Thank you!
#3
10/05/2012 (12:40 am)
You can't just export with no collision and then check use visible mesh?

i226.photobucket.com/albums/dd48/stacalkas/Untitled.jpg
#4
10/05/2012 (7:09 am)
I can, and it works, but my friend (the programmer) tells me that that is inefficient/not useful for our current goal, so here I am!
#5
10/05/2012 (7:35 am)
I've recently created collision meshes inside 3DS Max from relatively simple models I have gotten from my artists, and these seem to work best for me (I'm able to collide with all 3 meshes as expected with collisionType set to collision mesh):

This is the building
i.imgur.com/wg2Z5.png
concave building mesh is the grey (building01)
collision meshes are the red, blue and orange (col-1, col-2, col-3)
bounds is the yellow (bounds)
green is a few dummy nodes (base01, start01, collision-1, collision-2, collision-3)

---------------

And this is how it's all linked together
i.imgur.com/iJksN.png
green is the dummy nodes
purple is building mesh, collision meshes and the bounds


---------------


I haven't really done much in the shape editor to tell you how these equate to what, but if you have access to the source model files, it shouldn't be too hard depending on your modelling program.
#6
10/08/2012 (10:50 am)
Hey guys, your advice has been very helpful, so thank you for that! However, I'm still having difficulties with this. I set up the parent hierarchy exactly as you demonstrated, Steven, but the Shape Editor is still giving m e issues. It asks me to specify ONE collision mesh, when I have 8! As one, I'm not too sure what settings I should be using.

Edit: I should clarify, since I misspoke. I'm not sure what the dummy nodes are for, so I didn't include those.

Thanks again,
Zetal
#7
10/08/2012 (2:33 pm)
From what I can tell, T3D uses the dummy nodes to loop through and see what collision meshes there are to use. They seem to be needed, though. (they can be placed anywhere, so I just place them at 0,0,0).

You need one "collision-#" dummy node for each "col-#" collision mesh.

Check this for the node setup: docs.garagegames.com/artist/official/Overview/Overview.html#Basic_DTS_Hierarchy
#8
10/09/2012 (9:19 am)
I see this is for DTS- I've been using DAE...does the same information apply? Just out of curiosity- I'm going to be setting up that hierarchy now regardless, but just for future reference.

Thanks again!
#9
10/09/2012 (4:16 pm)
Same information applies. Torque converts the collada (DAE) file to a DTS anyway on import. (notice the cached.dts file after you've imported your models. If torque sees the cached.dts file in the path where you specified the DAE, it will use it instead, delete the cached.dts file, it will just regenerate next time the shape is loaded).

Just a note, torque can generate the bounds box itself, but I like putting my own in. (it's good habit :) )
#10
10/09/2012 (5:17 pm)
Hooray! I got it working! ...For the most part. For some reason, the collision-1 dummy nodes are producing collision as well. ???

Edit: Apparently I've lied- it's not working. Whenever I export the DAE, the collision meshes get extremely blown up. To an absurd degree. I opened the DAE in blender and it looks completely different from the .blend file.

What in the world?
#11
10/09/2012 (10:04 pm)
What does your model look like in the "shape editor"?

I know, using Steven's node setup, My DAE exports just fine from 3ds Max with 17 collision boxes. Someone who knows Blender may have to chime in...
#12
10/09/2012 (11:49 pm)
I find blender extremely hard to use (this coming from a programmer) so I can't help with that, sorry.

I can't say I have ever had that issue.

Though, I have heard from some that you can't scale it with 3DS Max's tools (not sure if its the same in blender). so if you wanted to make them larger, you to go into edit poly mode and pull out/push in the faces yourself. Maybe that's the problem?
#13
10/10/2012 (6:37 am)
!
You know, I think that's it!
I'll try that later today after class.
#14
10/10/2012 (8:56 am)
Okay so, I eliminated the Scale modifier from all of the Collision meshes, and the hierarchy is set up almost exactly the same (minus the collision-1 dummy nodes, as it seems to work without those, and the dummy nodes had collision as well, for whatever reason). Any ideas...? =\ It still doesn't work.
#15
10/10/2012 (2:59 pm)
Only other thing thatI've heard troubles with exporting to COLLADA is you should only create the collision meshes and bounds box in the perspective view. (Once again, might not be a problem with blender, though, I've never had a problem in other views, worth a try?).

Alternatively, you could probably find a DTS exporter for blender and use that instead of using COLLADA (DAE).

Need someone with Blender knowledge to pop in, now :(
#16
10/11/2012 (12:01 pm)
"Need someone with Blender knowledge to pop in, now"

They seem fairly few and far between, here... is Blender that difficult to make work with T3D?
#17
10/12/2012 (9:20 am)
nope, its just that everyone is making games with illegal non commercial versions of 3ds max
#18
10/15/2012 (5:19 pm)
Hey Guys,

After a ton of testing/random flailing in Blender I figured out what the problem was.
Here are the steps I took to fix it.

1) If you've already tried to make it work without following this, delete the collision meshes and start over.
2) Do not make any changes to any of the collision meshes you're adding in Object mode. Make sure they're positioned at 0,0,0 and have no scaling changes.
3) Set them as a child of the object you're making collision for.
4) Go into Edit mode and make the changes you need to, including positioning them. Don't even move them using Object Mode. All Edit mode.
5) Probably success. Repeat for each mesh.
#19
10/16/2012 (4:26 am)
Good job Michael!

Glad you got it working.

Best way I know to check the collision mesh is to put it into the world and try and collide with it :)