Game Development Community

Anyone know how to call animations?

by Robert Garrett · in Torque Game Engine · 06/27/2002 (6:05 pm) · 4 replies

Hi there. I'm currently working on a game which incorporates melee fighting and I'm having a little bit of trouble calling my animations. I need to be able to run and swing at the same time, but the only way I've been able to figure out for calling animations from the script is by doing something like this:

moveMap.bindCmd( mouse, button1, "commandToServer
('playCel',\"swing\");", "" );


Now this plays my animation very nicely, but my problem is that evidently "Cel" animations (i.e. wave and salute) are played on the same thread as the run animation, so I can't get them to play at the same time, even though the run and swing animation are using different nodes for the movement. Anyone have some idea how I can call a second thread of animation from the script, or atleast where in the code I can look to alter it so that I can? Also, since I have you here, would you happen to know how I can unbind the arms from the mouse look in third person? It makes sense in a shooter to have the arms move and point where you're aiming, but in a sword fighting game it just looks dumb, specially when you're looking at the ground.

Thanks for your time and sharing of wisdom =)

#1
06/27/2002 (6:51 pm)
I'd like to add an adendum to my previous post. I've been able to map my swing to the ActionThread present in the player by doing this:

function serverCmdSwing(%client)
{
%client.player.setActionThread(swing);
//echo("working");
}

moveMap.bindCmd(mouse, button1, "commandToServer('Swing');","" );

Where 'swing' is the name of my animation. However, I still can't seem to get the Run and Swing animations to run on seperate threads. He swings just fine, but the minute I start running he stops the upper body motion.

Thx for any answers
#2
06/27/2002 (10:15 pm)
Although I don't like cross-posting (you never know in which thread you should answer or look for answers, and it complicates the searching process, cause you find lots of threads with almost similar titles and the most of them don't contain any answers ...), but anyhow...
you might want to have a look at www.garagegames.com/docs/torque/tools/max2dts/section3.html#blend, I think you're only problem may be that your blend animations aren't named properly...
#3
06/28/2002 (6:41 am)
Thank you for answering Stefan. I've read that part of the docs and I tried using blend aimations as well as normal animations and neither one seems to work, in fact the blend animation export works worse than the default one, since the body parts snap back to the root pose when I start running, rather than transitioning. I've even tried setting the sequence priority of my swing to a higher number but that doesn't work either (btw, which is higher on that? 0 or 9?) What I think needs to be done is to play the swing animation on its own seperate thread, although I could and mostly likely am wrong, hehe.
#4
06/28/2002 (11:59 am)
Update, I've sort of solved the problem by using a hack. It seems the way I was doing it had no chance of working, since I've read on some very old posts that the ActionThread function I was using gets over-ridden by the running thread no matter what you do. I found a recoil thread however, which animates everytime you fire your weapon and does not get over-ridden by anything since it runs on its own thread, and I've created a function which fires with no projectiles. The only problem I had was that the recoil animation does not update server-side, so it might have interfered with collisions, but it was only a couple of lines of code to fix that. If anyone has a less "hack-like" way to do this I would be very interested in it, so please don't hesitate to post it. I hope my way atleast helps somebody.