Game Development Community

How do you trigger player animations on multiple threads?

by Robert Garrett · in Torque Game Engine · 06/27/2002 (7: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:


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.
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 =)


P.S. I've posted this question on the "Getting Started" forum also, so you only need to answer one of them. Sorry about spamming, but I'm desperate and on a very tight time schedule since this is for a school project. I've been working on this game about 120 hours a week for the past month and I'm just about ready to shoot myself, hehe.

#1
06/27/2002 (7:16 pm)
Hi. I'm usually a nice and helpful individual. However you sir, have pushed me over the edge.

Asking a question is fine, and is your right as a consumer of this particular product. However your cross posting is absolutely horrific and rude to boot and by doing so you alienate those trying to help you.

There is a handy search feature at the top of this page. I suggest you make use of it.
#2
06/27/2002 (7:21 pm)
My apologies Robert, I absolutely had no intention of offending you or making it seem like I was trying to abuse the forums. Unfortunately as I stated above, I am on a very tight schedule and I need this problem solved before I can continue any further. I have used the search and I have scoured through all the forums and could not find an answer, so this was my last resort. Please forgive me and consider this an act of a man who has slept maybe a total of 30 hours this enitre month, so is not at his best.
#3
06/29/2002 (11:38 am)
Mr. Blanchet, you need to relax. People who are new to the community may not know the proper location to start a thread in. The owner of this thread clearly, and respectfully tells us that he has cross posted. Your comments concerning your personal feelings of being offended and "going over the edge" are more out of place than anything I can imagine. Something this minor in its nature should not get your panties all bunched up. While I see that you have contributed greatly to this community, if you dont like someones post, just dont reply.

:)
Mike
#4
06/29/2002 (5:15 pm)
Player movement is run on the action thread, and takes precedence over anything you set. The way to get a second animation running is to use the ShapeBase::playThread script functions. That interface allows you to play up to four sequences (on seperate threads) at the same time. If you look at the bottom of the ShapeBase.cc file, where all the console methods are defined, you'll see set of playThread, stopThread, etc. methods.

Make sure your swing sequence is a blend if you want it to play on top of anything else you have going, or make sure it doesn't animated the same bones. (Normally only one sequence at a time can modify a given bone, unless blending is used).