Character animations overlapping each other.

Hi,I was wondering if you guys could help me solve this problem.

Because of the priority in BGE logic bricks my falling and jumping animation keeps being overlapped by the idle animation which causes to only make the character do a walk animation even when the w key is not pressed,so I was wondering if someone knows a way on how can I add the animations using python to solve the problem.
(I already tried some other scripts which I found in blender-artists but they don’t seem to work)
Thanks in advance.

How about deactivating the idle animation before playing the other one?

@ Monster@ It might be a good idea but I’m not sure if it will work after adding at least 6 animations to the character.

Hi Fenice!

Personally i don’t use priority. Instead i do as per following and it works perfectly for me, maybe you can give it a try.:yes:


if key_01.positive:
    object.playAction('action_01', ......)
elif key_02.positive:
    object.playAction('action_02', ......)
....
.... #(more elif)
....
elif not any(x.positive for x in cont.sensors):
    object.playAction('action_idle', ......)

@love blender@ thanks you for the reply,I tried it but I think I messed up the script.[TABLE=“class: outer_border, width: 500”]

import bge

def main():
cont = bge.logic.getCurrentController()
own = cont.owner

Keyboard = bge.logic.keyboard

## Actuators;
w = cont.actuators['Run']
back = cont.actuators['back']

##*********************

w_key = bge.logic.KX_INPUT_ACTIVE == Keyboard.events[bge.events.WKEY]
space_key = bge.logic.KX_INPUT_ACTIVE == Keyboard.events[bge.events.SPACEKEY]


if d_key.positive:
 object.playAction('Run')


elif a_key:
   cont.deactivate(front)
   cont.activate(back) ##


elif spacebar_key.positive:
  object.playAction('jump')


#(more elif)


elif not any(x.positive for x in cont.sensors):
  object.playAction('idle')

main()

[/TABLE]

After updating to Blender 2.9 I’ve experienced the same problem as before in which if 2 animations or more are added one of the animation will overlap all the others animations leaving the character to only do one animation,so I was wondering if anyone knows how to set up the property of the animations so that I can have more than 2 animations without overlapping each other.

Hello

use “layers”, one animation in each layer ( if I understood dell)?
Bye

Ok, maybe - and I say maybe because I know less than zero about animations, they just happen to work for me - it’s the “white star button thing”?
I feel kinda stupid because this is magic mixed with ignorance but, hey, it may even work.
In the NLA editor there is a snowflake like button next to the currently edited animation. Press it so that the animation becomes… un-snowflaked (being technical here).
No snowflakes it’s good for multiple animations on the same object.

OTO - Thank you for the suggestion , I tried that but if I use layers it works but the transition between each animation is sudden (It won’t let me blend the animations)

pgi - Thanks for your help,but the problem is in the logic bricks which won’t let me have more than 2 animations even if the priority is changed.

Ok, So have a controller like this, and use properties

if “Jump”=0------and--------Idle = 1
if “Walk”=0------/

if “Jump” is not 0-----------------Idle=0
if “Walk” is not 0-----------------Idle=0

if “Idle”=1-------and---------play action Idle

If Keypress “W”–and-------Walk =1
“Jump”=0-----------/

if Walk min:1 max:end frame -1-----and----add 1 to walk

if Walk = end frame---------and----------Walk =0

if Jump=0-------------and-------------Action walk animation - property based
if Walk is not 0------/

If Jump =0------------and-------------Jump = 1
if keypress Space—/

if Jump min:1 max:end frame -1------and----------Jump add 1

if Jump is not 0-------------------and------------Play animation Jump - property based “Jump”

So if not jumping or walking play idle,

if walking and then press jump play jump

etc using logic

So the property walk, in a 30 frame walk cycle looks like this

0
keypress W
1
2
3
4
5
6
…and so on
30
0

Here check this out

W - walk animation(no forward force applied)

Space =Jump -(forces applied using parent)

Idle plays if both are not playing(jump and walk)

Attachments

3AnimationsPropertyControled.blend (458 KB)

BluePrintRandom: Thank you,now the animations works fine.
Hope that in the 2.7 blender version they will change the animation properties to be more user friendly.