Need my full Swimming animation to play
by Nmuta Jones · in Torque Game Engine · 07/08/2008 (2:41 pm) · 7 replies
I implemented the 'swimming in one step' resource and it works great.
And I put a swimming animation in there to go with it.
The only thing I need help with.... when it plays my swimming animations when underwater, it does not play all frames of the swimming animation. It just plays a few frames of it, then loops those few frames. So it's choppy.
My full swimming animation is 45 frames long.
So I made an animation sequence dummy in Max and set the beginning/end keys to 55 and 100, respectively.
Anyone know how to let the engine know to play all frames of the swimming animation?
And I put a swimming animation in there to go with it.
The only thing I need help with.... when it plays my swimming animations when underwater, it does not play all frames of the swimming animation. It just plays a few frames of it, then loops those few frames. So it's choppy.
My full swimming animation is 45 frames long.
So I made an animation sequence dummy in Max and set the beginning/end keys to 55 and 100, respectively.
Anyone know how to let the engine know to play all frames of the swimming animation?
About the author
Lead Developer for MediaBreeze Multimedia
#2
07/08/2008 (3:11 pm)
Where at in Player.cc? To my understanding, the animation should be started from the pick animation function (can't remember it's name =P) otherwise it'll get replaced by another animation.
#3
07/08/2008 (5:34 pm)
...the pick animation function. Ok I'll look for it.
#5
void Player::pickActionAnimation()
Ok, so I see I just need to determine if I'm underwater, and then set the "action" variable to match my swimming thread.
07/08/2008 (5:57 pm)
Thanks. I see it now:void Player::pickActionAnimation()
Ok, so I see I just need to determine if I'm underwater, and then set the "action" variable to match my swimming thread.
#6
07/08/2008 (6:12 pm)
Yea. What I did for mine, was copy the code for selecting a movement animations (on the ground), and while searching for the animation, make sure it has "swim" as the first four letters of the animation. Seems to work fairly well, but I have a couple of problems with it, but I'm willing to bet that they come from me not having the animations I call for! =D
#7
if (inLiquid){
action = PlayerData::SwimAnim;
}
right at the end of the
pickActionAnimation()
function.
It plays the full animation when swimming underwater and looks very good. The way the pickActionAnimation() function is set up is kind of like a finite state machine.... lots of if/thens, and doing it the way I'm doing it causes the "fall" animation to be replaced by swimming, but I think that's only because I have not yet defined a fall animation in my sequences.
Thanks for the heads up. Swimming was a "must have" for me for Torque and so far getting it to work has been much easier than I anticipated.
07/08/2008 (8:39 pm)
I got swimming underwater to work flawlessly by doing this:if (inLiquid){
action = PlayerData::SwimAnim;
}
right at the end of the
pickActionAnimation()
function.
It plays the full animation when swimming underwater and looks very good. The way the pickActionAnimation() function is set up is kind of like a finite state machine.... lots of if/thens, and doing it the way I'm doing it causes the "fall" animation to be replaced by swimming, but I think that's only because I have not yet defined a fall animation in my sequences.
Thanks for the heads up. Swimming was a "must have" for me for Torque and so far getting it to work has been much easier than I anticipated.
Torque Owner Nmuta Jones
in player.cc:
else if (inLiquid)
{
...code....
setActionThread(PlayerData::SwimAnim,true,false,false);
...code....
}