DTS Collisions Best practices
by Benjamin Schneider · in Artist Corner · 10/09/2006 (3:36 pm) · 6 replies
I've searched the forums, online documentation, Maurina's and Finney's books on Torque for a best practices for how to approach collisions for DTS objects but haven't found the information I'm seeking. I placed this thread in the artist section because I'm looking at this from a content creation perspective and I'm hoping this thread can generate some helpful responses for the entire Torque community.
First, let me say that my questions deal with animated objects. Danny's tutorial explains collisions for static objects quite well.
Okay, let's take a swinging door, for example. In the comments section of this snapshot...
http://www.garagegames.com/mg/snapshot/view.php?qid=1280
... Stephen Zepp says, "...If you are having issues with a 2000 poly model rendering slowly in TGE on a high end machine, I would do some extensive troubleshooting on the model itself, including texture sizes, tri-stripping, and/or some of the no-no's when it comes to DTS shapes like animated collision meshes."
The key point I'm focused on is the "no animated collision meshes." Let's just say I have a simple, swinging door. If I don't duplicate the door geometry as my collision mesh and animate that collision mesh (by constraining it to my door's mesh in Maya), then how would my character be able to walk through the doorway when the door opens? Meaning, if I enclose the door's geometry in all animated states (similar to the bounding box) with my collision meshes, my characters will never be able to get through the open door. I ran across this thread...
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6021
Synopsis:
This resource allows you to create two or more sets of collision and los meshes and dynamically turn them off and on through script for each shape instance. I started this resource in order to be able to use a dts shape as a door, but it has other possible uses, such as crushable shapes.
Is this the preferred way to handle this? Turn the collision off in the engine when the door is open? If so, that's fine but doesn't work for my next example.
If I create a character that has animations to extend their arms, etc. and can't have my collisions move with the character's arms (rather than enclose all of the character's movements) then my character's collision would be as wide as the space required for extended arms at all times, thus they wouldn't fit through a typical doorway.
Any input from the Torque veterans and/or staff would be very much appreciated.
Thanks,
Ben
First, let me say that my questions deal with animated objects. Danny's tutorial explains collisions for static objects quite well.
Okay, let's take a swinging door, for example. In the comments section of this snapshot...
http://www.garagegames.com/mg/snapshot/view.php?qid=1280
... Stephen Zepp says, "...If you are having issues with a 2000 poly model rendering slowly in TGE on a high end machine, I would do some extensive troubleshooting on the model itself, including texture sizes, tri-stripping, and/or some of the no-no's when it comes to DTS shapes like animated collision meshes."
The key point I'm focused on is the "no animated collision meshes." Let's just say I have a simple, swinging door. If I don't duplicate the door geometry as my collision mesh and animate that collision mesh (by constraining it to my door's mesh in Maya), then how would my character be able to walk through the doorway when the door opens? Meaning, if I enclose the door's geometry in all animated states (similar to the bounding box) with my collision meshes, my characters will never be able to get through the open door. I ran across this thread...
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6021
Synopsis:
This resource allows you to create two or more sets of collision and los meshes and dynamically turn them off and on through script for each shape instance. I started this resource in order to be able to use a dts shape as a door, but it has other possible uses, such as crushable shapes.
Is this the preferred way to handle this? Turn the collision off in the engine when the door is open? If so, that's fine but doesn't work for my next example.
If I create a character that has animations to extend their arms, etc. and can't have my collisions move with the character's arms (rather than enclose all of the character's movements) then my character's collision would be as wide as the space required for extended arms at all times, thus they wouldn't fit through a typical doorway.
Any input from the Torque veterans and/or staff would be very much appreciated.
Thanks,
Ben
#2
where as opening the door is simply "transforming" the mesh on a pivot point or such.
in any case with your character example, you should not need to utilize the actual character mesh for collision either.
instead you should use some other primitive to capsulate portions of the player mesh.
(cylinder arms, ...)
10/10/2006 (10:46 pm)
Well, my thoughts are that the "Animated" collision mesh referenced here, is basically a deforming mesh.where as opening the door is simply "transforming" the mesh on a pivot point or such.
in any case with your character example, you should not need to utilize the actual character mesh for collision either.
instead you should use some other primitive to capsulate portions of the player mesh.
(cylinder arms, ...)
#3
But when you animate your door use a bone and attach the collision mesh to that and animate the bone then it should work.
I am a max user so don't know what it takes to do it in Maya.
10/12/2006 (8:03 am)
Animated collision meshes form my experience don't' work. as soon as they start to animate the collision sets to exist.. I tried to make a catapult where I could drive my car up onto and fling it across the scene.. NOPE.. as soon as it started to animate the car would drop to the terrain.But when you animate your door use a bone and attach the collision mesh to that and animate the bone then it should work.
I am a max user so don't know what it takes to do it in Maya.
#4
for swinging doors, i guess you could use one dts for the door object and a separate invisible dts for actually blocking entry. when the door opens, just remove the invisible dts. you could do the same trick using an invisible dif instead. then just replace the barrier object when the door closes.
10/12/2006 (8:56 am)
Like affectworks said, exported collision meshes are only used for non-player objects. for players and aiplayers, this mesh is ignored and the collision box is set using the datablock of the character.for swinging doors, i guess you could use one dts for the door object and a separate invisible dts for actually blocking entry. when the door opens, just remove the invisible dts. you could do the same trick using an invisible dif instead. then just replace the barrier object when the door closes.
#5
there is no reason you cannot transform the collision mesh.
just dont deform it.
when the door opens it should be a simple rotation upon the collision object.
no problem.
dts doors are stinky bum anyhow.
should be using the diff doors and all your pain will go away.
the guy that finished the moving platform code that is the code to use for doors.
10/12/2006 (10:42 am)
Yuck.there is no reason you cannot transform the collision mesh.
just dont deform it.
when the door opens it should be a simple rotation upon the collision object.
no problem.
dts doors are stinky bum anyhow.
should be using the diff doors and all your pain will go away.
the guy that finished the moving platform code that is the code to use for doors.
#6
so you should be fine doing this for a door.
*correction - is it 8 collision meshes, or 8 mount points per model max? I know theres an 8 in there somewhere...
10/12/2006 (11:18 am)
It was my understanding that collision meshes could be animated as well. but I think there's a bit of confusion when referring to animating a collision mesh. someone correct me if I'm wrong, but I think in Stephen Zepp's post when he mentioned animating collision mesh, he was talking about having a complete collision mesh rigged to a skeleton and attempting to do bone rotations on it. this is what won't work. the correct way would be to split the collision model into (8 max.) separate meshes and rigging to the skeleton such that each collision mesh is attached to only one bone. you shouldnt try to attach a collision mesh to more than one bone. so individual collision meshes can be transformed during an animation, just not defomed at the vertex level. so you should be fine doing this for a door.
*correction - is it 8 collision meshes, or 8 mount points per model max? I know theres an 8 in there somewhere...
Torque 3D Owner Affectworks
This is how I understand it; when you have a door or a energy field or anything that blocks the player and then maybe they hit a switch or something, you switch meshes between one that has collision built in and one that hasn't. Animating collision boxes are just a waste of resources from what I understand.
The players collision box is actually being created in script, so when you create a player dts you don't need to create a collision mesh for it. I am not a very good programmer (my colleague does that), so I am not sure where you set the size for the collision box, but if you want to I'll ask him.