Player attack animation overwritten by movement (Solved, thanks David)
by 000 · in Torque 3D Professional · 10/21/2012 (12:05 am) · 5 replies
While at a stand still, the player animates the melee weapon attack (via setActionThread), however when the player is moving and firing the players movement animation is the only one playing. Anyone know how I can have the firing animation play instead/at the same time? (I have blended animations setup, although I can set it up without)
#2
If you wish to play both of them,then you need a secondary animation thread.
If you wish to play a single sequence,then try to push a different animation priority for the shoot sequence (as I remember priority 1 > priority 0).
Another one decision is to put a code that skips the transition to the root sequence when the shoot sequence is played.
There are many solutions, depends on what you want to do.
10/26/2012 (1:58 am)
This is because you have a single action thread, that handles two sequences.And you have to play only one.If you wish to play both of them,then you need a secondary animation thread.
If you wish to play a single sequence,then try to push a different animation priority for the shoot sequence (as I remember priority 1 > priority 0).
Another one decision is to put a code that skips the transition to the root sequence when the shoot sequence is played.
There are many solutions, depends on what you want to do.
#3
11/01/2012 (6:39 pm)
This was a pretty hard task i did for my development. I actually made the changes via player object making sure forward velocity was not calculated as soon as action is triggered. The issue with script is that there are loopholes that controlling this via player object completely rectified.
#4
What about rather than forcing the animation sequence change with setActionThread() you used the ShapeBaseImage animation state system? That was intended to allow playing of a firing (and reload, etc.) sequence over top of the player's standard action sequence.
As you're using a melee weapon, this sounds like a natural fit. You could even use this for punching by just using a basic, geometry free object for your ShapeBaseImage definition (it will be in the player's hand, but you won't see it). I had talked with Mich about using this for his Zombies once, but I do not know if he went in that direction.
- Dave
11/05/2012 (7:36 am)
@Mack:What about rather than forcing the animation sequence change with setActionThread() you used the ShapeBaseImage animation state system? That was intended to allow playing of a firing (and reload, etc.) sequence over top of the player's standard action sequence.
As you're using a melee weapon, this sounds like a natural fit. You could even use this for punching by just using a basic, geometry free object for your ShapeBaseImage definition (it will be in the player's hand, but you won't see it). I had talked with Mich about using this for his Zombies once, but I do not know if he went in that direction.
- Dave
#5
11/05/2012 (8:26 am)
The ShapeBase animation system can create a new animation thread, but there is no transitioning between sequences. I believe a possible solution is to replace setSequence() with transitionToSequence(), but this is an ugly solution and this code should go the the player class as well.
Torque Owner Dimitris Matsouliadis
Dimitris Matsouliadis
eg the player run and we press the button for a hit
Recording the button and we stopping, plays which animation and we want to end the animation by reviving the movement of the player.
The animation may be proportional to the depressed key or combination.
costs nothing because it is on client side.
The better method is the blend animations on player moves.
eg script code
<code>
function mouseFire(%val)
{
$mouseFire = %val;
...
function moveforward(%val)
{
if ($lockKeyboard < 1)
{
$mvForwardAction = %val * $movementSpeed
%useMoveBtn = 1;
if ( $mouseFire > 0)
setPlayerAction(%useMoveBtn);
.....
setPlayerAction(%useMoveBtn)
{
$mvForwardAction = 0;
%thisSeq = "hitsword"; //any animation
$lockKeyboard = 1;
commandToServer('playAnimation', %thisSeq);
schedule(1000 , 0, "resetSequence", %useMoveBtn);
}
resetSequence(%useMoveBtn)
{
if (%useMoveBtn == 1)
{
$mvForwardAction = $movementSpeed;
$lockKeyboard = 0;
}
}
</code>