Help me with triggered Animation please!
by Bobby Leighton · in Torque 3D Professional · 05/31/2010 (2:04 pm) · 11 replies
Here is what I am trying to do:
I'm creating a sample game for my senior project that is basically a "Stargate" rip off game for the most part( I have permission btw in case anyone is worried about that), or at-least it has a stargate in it and I am trying to animate it. I have 2 files in COLLADA format that load into the engine without a problem, one called ancientgate.DAE and the other is ancientGate_anim.DAE, and I can load up the animation in the editor and it play fine as ambient by itself just running endlessly, so i know it does work(BTW COLLADA RULES!)
I have tried loading in the static first, and then loading it in the shape editor and then loading the animation for the "dialing" sequence, and I call it of coarse "dial", then I save it.
I have made a trigger for it called dialTrigger, and the trigger seems to work as i put some echo calls to print to console for onEnter and onLeave, both are saying the are working fine. I have tried things like pleyThread and such like this:
function DoorTrigger::onEnterTrigger( %this, %trigger, %obj) {
echo("Entered GateTrigger");
%obj.playThread( 0, "dial");
}
function DoorTrigger::onLeaveTrigger( %this, %trigger, %obj) {
echo("Left GateTrigger");
%obj.playThread( 0, "dial");
}
I have tried %trigger instead of %obj, as well as %this, and no luck the wheel will not move
I have also tried to make it a static object such as:
datablock StaticShapeData(gate)
{
shapeFile = "art/shapes/Gate/ancientGate.DAE";
category = "StaticShape";
};
Could someone please help me with this proccess, I would even be happy to trade some work for some help on this one, as I really need it and things like this working for my senior project to be complete. I would REALLY apreciate help of any kind! *Begs Shamlessly*
I'm creating a sample game for my senior project that is basically a "Stargate" rip off game for the most part( I have permission btw in case anyone is worried about that), or at-least it has a stargate in it and I am trying to animate it. I have 2 files in COLLADA format that load into the engine without a problem, one called ancientgate.DAE and the other is ancientGate_anim.DAE, and I can load up the animation in the editor and it play fine as ambient by itself just running endlessly, so i know it does work(BTW COLLADA RULES!)
I have tried loading in the static first, and then loading it in the shape editor and then loading the animation for the "dialing" sequence, and I call it of coarse "dial", then I save it.
I have made a trigger for it called dialTrigger, and the trigger seems to work as i put some echo calls to print to console for onEnter and onLeave, both are saying the are working fine. I have tried things like pleyThread and such like this:
function DoorTrigger::onEnterTrigger( %this, %trigger, %obj) {
echo("Entered GateTrigger");
%obj.playThread( 0, "dial");
}
function DoorTrigger::onLeaveTrigger( %this, %trigger, %obj) {
echo("Left GateTrigger");
%obj.playThread( 0, "dial");
}
I have tried %trigger instead of %obj, as well as %this, and no luck the wheel will not move
I have also tried to make it a static object such as:
datablock StaticShapeData(gate)
{
shapeFile = "art/shapes/Gate/ancientGate.DAE";
category = "StaticShape";
};
Could someone please help me with this proccess, I would even be happy to trade some work for some help on this one, as I really need it and things like this working for my senior project to be complete. I would REALLY apreciate help of any kind! *Begs Shamlessly*
#2
05/31/2010 (6:38 pm)
Thanks, I got that resource working easily, now Ill figure out how it doing it animation, although i think it is just moving the objects with torque-script and not calling an animation, although I could be wrong I haven't looked at the script yet:O)
#3
05/31/2010 (7:22 pm)
not working yet...not sure why though, and its using playThread too...hmmmm
#4
05/31/2010 (7:48 pm)
I am beginning to think that they just are not going to work and I really need it to, and if triggers don't work how can anyone make a game without them?
#6
edit: WOOT! Thank you that was the missing piece!
05/31/2010 (11:45 pm)
ahh Ill try that thank you! :O)edit: WOOT! Thank you that was the missing piece!
#7
Another thing is that you don't need the "" around dial in the playThread function. I don't know if it is working with the "", but I am using it without them and everything works fine.
05/31/2010 (11:51 pm)
The solution West Coast is suggesting is right. The %obj which is passed through the OnEnterTrigger function is the object that triggered it, which in most cases will be the player (or an AI).Another thing is that you don't need the "" around dial in the playThread function. I don't know if it is working with the "", but I am using it without them and everything works fine.
#8
06/01/2010 (12:51 pm)
yeah it working great, well it plays the animation but i cannot get it to stop. is there a list of Torque Script Functions somewhere? If this was C++ I would use a wait command then something to stop, or I would play the animation for a certain number on time then stop...not sure how though.
#9
argument 1 is time (in milliseconds),
argument 2 is function,
argument 3 is thread number or somhin'
I did own a list of Torque Script Functions sometime ago (i think it was the TGE manual), but I'm not sure where you can find these any more. But what i know for sure is that the Torque 3D documentation will contain this list when it comes. (And you can also use %obj.dump(); to find spesific class functions)
06/01/2010 (1:10 pm)
Eigther you can make your animation in one animation and uncheck cyclic form your model, or you can use a schedule like this:StarGate01.schedule(1000,stopThread,0)And just to clarify that code,
argument 1 is time (in milliseconds),
argument 2 is function,
argument 3 is thread number or somhin'
I did own a list of Torque Script Functions sometime ago (i think it was the TGE manual), but I'm not sure where you can find these any more. But what i know for sure is that the Torque 3D documentation will contain this list when it comes. (And you can also use %obj.dump(); to find spesific class functions)
#10
06/02/2010 (12:43 am)
Argument 3 (and if necessary 4, 5 ....n) in the schedule-function are the arguments needed by the function in argument 2. So you are right in this case that argument 3 is the thread number like %obj.stopThread(0).
#11
06/02/2010 (12:20 pm)
Great Thank you, this is just what I needed, and I did uncheck cyclic, and noticed that the animation stopped after it player through once. Thank you guys for your help, know how those are setup is just the step I was looking for....you know all through this programming degree i was afraid something like this(TorqueScript) seeming like such a problem was bugging me, but after you explained it like that it all made sense:O)
Torque 3D Owner Hans Cremers
http://www.torquepowered.com/community/resources/view/10200
It is all in script so most should work in T3D. Look at they way he calls the animation to open to door.
Good luck!