Game Development Community

Animated collision mesh

by Thomas Bang · in Torque Game Engine · 08/28/2008 (5:50 am) · 13 replies

Hi

Today i tried to build a animated door with two animation sequences ("open" and "close"). So i also animated the collision mesh.
I checked the animated collision mesh with Show Tool Pro. Perfect.

But i have problems in the game.

See this Video

#1
09/01/2008 (7:49 pm)
No, you can't do that in stock Torque. You'll have to write new engine collision code. You should be able to do it with a DIF, though, I think.

BTW, excellent video demonstrating your problem, though imho you'll get more people to take a look at such things if you keep the size under 5mb or so. I almost whacked it and moved on when I saw how big it was, but I was curious....
#2
09/01/2008 (8:00 pm)
I don't think that you could do it with DIF. I thought that they were meant to be static (hence only lighting when the scene loads).
#4
09/01/2008 (11:10 pm)
So...it is possible to collide with an animated collision mesh for DTS?
#5
09/02/2008 (6:42 am)
@Todd: Thanks, but these links are more or less useful. This kind of workaround is not what i want.
The door was only a example. I need animated collision meshes also for some parts of the gameplay.

@Garagegames: Is there a chance to get animated collision meshes in one of the next updates?
#6
09/02/2008 (7:01 am)
Have you looked at any of the free door resources here? There are several examples.
#7
09/02/2008 (8:42 am)
To my knowledge there has never been a way to use true, animated collision meshes in Torque.

The only time I've needed them is with rotating doors, and the solution was to do something like in those resources. I basically just manually rotate a separate, invisible collision box on top of the visible, animated mesh door. It was a pain to set up, but it works well enough.
#8
09/03/2008 (2:22 am)
OK, here is a quote from Edward F. Maurina's book "Multiplayer Gaming and Engine Coding for the Torque Game Engine":

Quote:
Animating Custom Collision Meshes

The vertices of a shape's custom collision mesh can be attached to bones, meaning they can be rotated, translated, and otherwise morphed by shape animations. A moving mesh won't act as an active collider, but it will act as a passive one.

If you have seen the video of the first post: The player is the active collider and the door is the passive collider.
#9
09/03/2008 (6:46 am)
Well, back in reality, my own tests have yielded negative results. I would love for someone to prove me wrong.

"Faking it" is often perfectly fine, however. Thomas, perhaps you could share some of the types of things you want to do with this? I'm sure we may have some useful ideas to offer. Torque is a very flexible engine.
#10
09/03/2008 (7:43 am)
...
#11
09/03/2008 (12:16 pm)
To Joseph's last point:
If you take a look at the updated terrain deformer resource, the source code changes include an onTerrainDeformed' method that alerts objects that cache their collision that something has changed. You could implement your own version of this, using it as an example, or simply leverage this existing system. Without any knowledge of this whatsoever, I'd suggest that when the door opens, it finds all objects within a certain distance and calls 'onTerrainDeformed' on them, so they can get rid of their cached collision information.
#12
09/03/2008 (12:35 pm)
@Thomas, I suggest integrating a proper physics solution. You'll easily be able to do more advanced collision representations. If you're doing a single player game, the PhysX resource would be good to look at. If it's going to be multiplayer, though, you'll need to do some work to get that set up properly.
#13
09/04/2008 (12:28 am)
@Lee: Yes, you are right. To "fake" some things is better in some cases.

@Joseph & Daniel: I tried the "terrain deformer resource" but i does not help.

@Ross: Yes, PhysX would be cool. But i dont have enough knowledge about how to integrate PhysX in TGE.