trying to do jump animation,
i knew loop ended animation.
but how to you make player stand animation after it hits landing?
trying to do jump animation,
i knew loop ended animation.
but how to you make player stand animation after it hits landing?
you should set the priority of your animations
Example:
Action Jump , priority = 1, activate with Space key
Action Land , priority = 0, activate with ground collision
Land will be played and Jump will be forgotten
yeah, but then you burn CPU cycles on a animation that is not playing,
I like to use python to activate/deactivate animations,
(check out gamelogic simple in templates in the text editor)
and make sure they are all on different layers,
I do
if not jumping or on ladder_> if moving play walk, else play idle
there are many ways to handle it,
but I use
If keypress jump and property jump is zero, set jump to one
if jump >0 and jump<(end frame of jump rising -1) add 1 to jump
if falling down, and jump == (end frame of jump rising -1) -> set jump to falling frame 1
if jump < end frame falling-1 -> add 1 to jump
if hit ground and jump>10 -> start playing landing
if landing = end frame -> set jump to zero.
Explanation
You can never know exactly how long a player will be in the air for, which means you have to split up the animation:
-Jumping (pushing off ground)
-in air (slow flailing arms)
-Landing (crouching)
Play the jump animation when the player presses space, play the in air animation when not on the ground (ray sensor, -z, 5, inverted), play the landing animation when the player hits the ground (ray sensor, -z, 5, tap).
For landing it is best to use a ray sensor so your character has a couple frames to adjust before hitting the ground.
With a collision sensor you will only play the animation after you hit, which doesn’t look good.
Also you might need to set priorities as rockymadio mentioned.
I would use states if I were using logic,but the movment sensor brick is not in stock blender yet, so you need to poll world LinearVelocity.z while in the rising state…
Python is much easier for me, for this type of thing.
I will try and make it as simple as possible and post it tonight.
i mean jump animation.
i did the jump already. i just need to know animation jump
see the number ‘Jump’?
use this with a animation actuator set in property mode
#it is currently there but disabled
setup your jump animation - (in this file 0-5 jumping) 5-30 rising (30-60) fall cycle and 60-90 = landing.
step 1 - make jump animation (make sure to set it up the right length, or adjust script)
step 2 - add property Jump to armature
step 3 - add action actuator set to property mode, set to use property ‘Jump’, set actuator name
to Jump
step 4 - grab cube -> shift+click -> grab armature -> connect controller to actuator (Jump)
step 5 - remove the # from the code in the animation section (not the comments)
change this to*
# play or don't play jump animation
if own['Jump']!=0:
a='test'
#cont.actuators['Jump'].owner['Jump']=own['Jump']
#cont.activate(cont.actuators['Jump'])
else:
a='test'
#cont.deactivate(cont.actuators['Jump'])
this **
# play or don't play jump animation
if own['Jump']!=0:
cont.actuators['Jump'].owner['Jump']=own['Jump']
cont.activate(cont.actuators['Jump'])
else:
cont.deactivate(cont.actuators['Jump'])
hint* the cube is the physics bound, parent your armature to it**
A = ‘test’
was to keep the script from throwing a error with the code commented out*