Run DTS animation with a trigger
by BigPapa · in Torque Game Engine · 10/11/2005 (7:00 pm) · 4 replies
Hello gang,
I'm looking for information on how to run a DTS animation of an objects in the game by entering a trigger zone in the game.
For example. Lets say I want a trap door to open under my character if the character steps on it.
I immagine I can create the trap door and animation in Blender or any modeling program, export the DTS and DSQ and put them in the game. Then create a trigger for that DTS and create an onEnter function for the trigger. Then place the trigger on top of the trap door so when the character walks into the trigger locate on top of the trap door, the DTS animation runs and the character falls through.
Any help would be greatly appreciated. Thx!
I'm looking for information on how to run a DTS animation of an objects in the game by entering a trigger zone in the game.
For example. Lets say I want a trap door to open under my character if the character steps on it.
I immagine I can create the trap door and animation in Blender or any modeling program, export the DTS and DSQ and put them in the game. Then create a trigger for that DTS and create an onEnter function for the trigger. Then place the trigger on top of the trap door so when the character walks into the trigger locate on top of the trap door, the DTS animation runs and the character falls through.
Any help would be greatly appreciated. Thx!
#2
The only problem is the desired behavior in this particular case. The animation will run...but the player will not fall through. The reason is that collision meshes cannot be animated by DTS animations. If you actually move an object in the world by altering its transform...then of course the collision mesh will move with it. But if you attempt to move a collision mesh by a DTS animation it will fail.
Just a heads up.
10/11/2005 (8:55 pm)
The method above is the correct method.The only problem is the desired behavior in this particular case. The animation will run...but the player will not fall through. The reason is that collision meshes cannot be animated by DTS animations. If you actually move an object in the world by altering its transform...then of course the collision mesh will move with it. But if you attempt to move a collision mesh by a DTS animation it will fail.
Just a heads up.
#3
@Paul - Thanks for the heads up. I was playing around with the scripted door resource and noticed that the collision mesh is moved separate from the door DTS.
10/12/2005 (9:59 am)
@Kevin - Thanks for the sample code. Looks simple enough, don't know why I didn't think about that. I know the second part needs to be in triggers.cs but where should I put the first part; player.cs?@Paul - Thanks for the heads up. I was playing around with the scripted door resource and noticed that the collision mesh is moved separate from the door DTS.
#4
10/12/2005 (10:08 am)
Actually you could put it anywhere, but I have all simular functions in a single .cs file exec'd from server/scripts/commands.cs
Torque Owner Kevin Johnson
you'll probably wanna create a function somewhere something lke this
function PlayTriggeredAmin(%objectToAnimate,%animationName,%animationLength) { %objectToAnimate.playThread(0,%animationName); %objectToAnimate.schedule(%animationLength, "stopThread",0); }then call it in your onEnterTrigger
PlayTriggeredAmin(nameToId("TrapDoor1"),"anim1",1500);this is a very basic example, but should be enough to get you going