Game Development Community

Open collision meshes?

by Daniel Buckmaster · in Torque Game Engine Advanced · 08/19/2009 (4:34 am) · 7 replies

Is it possible to make collision meshes out of disconnected polygons? For example, if I make a triangular prism, it requires two triangles for each end, then six more triangles for the rectangular faces connecting the two triangles. To simplify this collision, is it possible to just use the two end triangles?
I know that could obviously create some collision errors, but is the principle sound? Or must all collision meshes be closed?

About the author

Studying mechatronic engineering and computer science at the University of Sydney. Game development is probably my most time-consuming hobby!


#1
08/19/2009 (12:29 pm)
You can make the collision mesh open.
I have done a lot of experimenting with this and the collision code seems ok with open meshes as long as the mesh overall is still convex.

#2
08/19/2009 (8:46 pm)
Hm, okay. I wonder if two intersecting triangles would be counted as convex? For example, a collision mesh for the crossbow being one triangle aligned with the body, and one triangle aligned with the 'wings'. Probably not :P. I'll do some testing with my own meshes, eventually.
#3
08/19/2009 (9:11 pm)
Open collision meshes won't register on LOS or raycast calls, but will provide player/object collision. I use one-sided/open meshes for things like windows, you can shoot through them but not run through them.

You can have multiple mesh objects under a Collision-# node, that seems to work fine.
#4
08/20/2009 (1:07 am)
Huh, that's interesting. I do intend to use hitboxes for projectile collision though, so those meshes can be higher resolution than the actual collision meshes. Thanks for the info.
Do you know if multiple collision objects works for RigidShapes? That's what I'm thinking of here, I probably should have mentioned :P.
#5
08/20/2009 (8:32 am)
Out of the box I think that TGE/A uses just the first collision mesh for rigid shapes.

I recall a thread discussing using all of them but can't locate it right now.
#6
08/21/2009 (3:49 pm)
A convex mesh can't be "open" but it depends on what you mean with that.
Just use multiple ones? That's how most physics engines do it out there, they just encapsulate the functionallity into a class and hide it from the user.
#7
08/21/2009 (10:13 pm)
While a convex mesh technically can't be open , TGE/A has no problem with a collision mesh that has missing polygons.

A simple example is to create a large box and create a collision mesh for it , simply copy the box mesh, and remove one whole side then export to a dts.
Load it in a TGE/A mission and then take the player and walk up to the "open" side and you will see you can walk thru the open end.

There are some oddities to doing this however.
While the player can enter and exit the object a projectile cannot shoot into the open mesh but it can shoot out of it.
This is due to the fact that a projectile uses a simple raycast to tell if it hit some and the the player uses a ExtrudedPolyList.