Trigger Animation Code / Blend Question
by Carleton University (#0010) · in Artist Corner · 06/12/2007 (1:20 pm) · 2 replies
This is a two part, the following code is what I have found to work for mapping a key to a specific animation. Note that the functions are generic, so all you need to do is replace "punch" with whatever your desired animation is.
moveMap.bindCmd(keyboard, "q", "commandToServer('playAnim',\"punch\");", "");
function serverCmdPlayAnim(%client,%anim)
{
if (isObject(%client.player))
%client.player.playAnimation(%anim);
}
function Player::playAnimation(%this,%anim)
{
%this.setActionThread(%anim);
}
The Problem with the above : I want to use this code to trigger a punch that my character will throw. I want this punch to be able to function even while the character is doing something else, such as running.
At present, this method of calling the animation will only allow it to be performed while the character is not already doing something (eg: standing still). If someone can tell me what I am doing wrong, or give me any hints or ideas, I would greatly appreciate it.
Thanks!!
moveMap.bindCmd(keyboard, "q", "commandToServer('playAnim',\"punch\");", "");
function serverCmdPlayAnim(%client,%anim)
{
if (isObject(%client.player))
%client.player.playAnimation(%anim);
}
function Player::playAnimation(%this,%anim)
{
%this.setActionThread(%anim);
}
The Problem with the above : I want to use this code to trigger a punch that my character will throw. I want this punch to be able to function even while the character is doing something else, such as running.
At present, this method of calling the animation will only allow it to be performed while the character is not already doing something (eg: standing still). If someone can tell me what I am doing wrong, or give me any hints or ideas, I would greatly appreciate it.
Thanks!!
#2
I'm not sure if I'm even setting up those files correctly either as I can't seem to find a simple explanation of exactly what to do.
Also, I've discovered that during a "run" it automatically takes precedence over everything else... which complicates things given that I want to add something on top of run. Maybe I'll start looking into changing the engine code itself to allow this.
06/14/2007 (10:43 am)
Yeah, I am using seperate dsq files..I'm not sure if I'm even setting up those files correctly either as I can't seem to find a simple explanation of exactly what to do.
Also, I've discovered that during a "run" it automatically takes precedence over everything else... which complicates things given that I want to add something on top of run. Maybe I'll start looking into changing the engine code itself to allow this.
Torque Owner Bryce
Tactical AI Kit