Jumping/Stand animation only plays first frame
by David Mode · in Torque Game Builder · 07/05/2012 (3:38 pm) · 2 replies
Hi everyone, I combed the forums to death trying to find out why I cant seem to get my character to play his jump animation when he jumps. I did find a few articles in the forums which address similar problems, but I either [A] didn't quite understand the solution or [B] it didn't really pertain to what I was doing.
I'm a pretty novice programmer, only recently started reading and practicing with C# and then more recently moved into the Torque environment. My player script is a frankenstein of tutorials and has a collision fix in it that I found elsewhere.
I assume the animation is playing, but it keeps restarting upon the update cycle. OR I'm just a knucklehead and aren't really getting something. It also leads me to another question... I have a standing/ idle animation that I seem to have the same problem with... only plays the first frame.
Bear with me, my code is a little sloppy and I haven't gone through it and cleaned it up yet.
Thanks guys and gals
my player.cs
I'm a pretty novice programmer, only recently started reading and practicing with C# and then more recently moved into the Torque environment. My player script is a frankenstein of tutorials and has a collision fix in it that I found elsewhere.
I assume the animation is playing, but it keeps restarting upon the update cycle. OR I'm just a knucklehead and aren't really getting something. It also leads me to another question... I have a standing/ idle animation that I seem to have the same problem with... only plays the first frame.
Bear with me, my code is a little sloppy and I haven't gone through it and cleaned it up yet.
Thanks guys and gals
my player.cs
#2
07/06/2012 (3:18 pm)
Wow, nice catch! Unfortunately it didnt fix my issues, but it would have been an issue down the road I'm sure. Thanks for trying though
Torque 3D Owner Tim Scheiman
Ghost Ship Studios
So all of the %yVelocity's in that function will be zero.
I didn't go through all the logic of that function, since that jumped out at me first... but try changing it to:
function playerClass::setCurrentAnimation(%this, %yVelocity)
and see if it starts behaving the way you thought it would.
:)
[edit] - line 128 might need to be removed or altered, given that the function has a parameter... you shouldn't need to set the animation more than once per update, though.