Blending animations

I have a new problem…with the BLEND_BLEND
i.e.
playAction(name, start_frame, end_frame, layer=0, priority=0, blendin=0, play_mode=KX_ACTION_MODE_PLAY, layer_weight=0.0, ipo_flags=0, speed=1.0, blend_mode=KX_ACTION_BLEND_BLEND)

I am able to call this fine, it is just not working …it’s not blending I have blendin set to 4 and it is not an empty animation…any tips?

I’m calling blend = bge.logic.KX_ACTION_BLEND_BLEND…or something…I’m off to work and my code in not open…I will update this post later.

EDIT:
sorry such a poor question, but It was before work and I was tired + on my way out the door :slight_smile:

below is what the actual code looks like…it is only a snippet as I would not animate every state this way…but the basic animation function I am using is the same…


        play = bge.logic.KX_ACTION_MODE_PLAY
        blend = bge.logic.KX_ACTION_BLEND_BLEND
        if own['anim_frames'] < 19:
            own['anim_frames'] += 1
                    
        elif own['anim_frames'] > 19:#20 frames
            own['anim_frames'] = 0
        #own.playAction('jump',own['anim_frames'],own['anim_frames'],play, speed = 1)
        ## work place...the above works for basic anim fallback
            own.playAction('jump', own['anim_frames'],own['anim_frames'], layer=0, priority=0, blendin=4, play, layer_weight=0.0, ipo_flags=0, speed = 1.0, blend)

and I am getting ‘positional argument follows keyword argument’…I have a basic understanding of what it means, but I am not seeing the problem…and I could not find any examples…have I assigned a value somewhere that was predefined or something??? I hope someone could point me to a link or something with a better explanation…I am just trying to blend into animations…I thought I could do it, but now I am having issues.

Has no one had success with this?..I would really hate to do this in bricks…or worse skip blending animations altogether :slight_smile:

In the playAction method call, use blend_mode=blend instead of just blend. In Python, you’re not allowed to use positional arguments (arguments in a function call that you don’t specify the keyword for) if you have keyword arguments (arguments in a function call that you include the keyword name for - e.g. layer=0) before it. That’s what “positional argument follows keyword argument” means.

You have a positional argument (blend) after the keyword arguments. That’s what the error is about.
That said - blend mode is actually supposed to be a keyword argument. Needs to look like this instead:

own.playAction('jump', own['anim_frames'], own['anim_frames'], layer=0, priority=0, blendin=4, play, layer_weight=0.0, ipo_flags=0, speed=1.0, blend_mode=blend)

EDIT
Damnit, too slow

I had a basic understanding of the error…but I’m no rocket scientist :slight_smile: thank you and I understand now…uh…sorta :slight_smile:

so I also need to move ‘play’ before ‘layer_weight = x’…correct? I will give it a shot.

ok, that did get rid of the error, but it just holds the last frame of animation from the previous animation…is there something very basic that I am doing wrong? I assume ‘blendin = float’ is like lerping 0-1 or is it frames to blend?? either way I am not getting it to work…I’ve stripped it down to things that I assume it will just use default values of 0…

like this


own.playAction('jump',own['anim_frames'],own['anim_frames'],play, speed = 1,blend_mode = blend, blendin=0.5)
#also tried
own.playAction('jump',own['anim_frames'],own['anim_frames'],play, speed = 1,blend_mode = blend, blendin=5)

If you’re running it every frame, then the blendin will prevent it from appearing. Because every time you run it, the blend-in starts from zero.

I had no idea, ty…wait…huh, so I need to run it between frames so to speak…at different blendin values? like over 4 frames (1,0.75,0.25)???

No, you just call it once at the start of the action, and Blender handles blending the action over the given amount of frames you specified.

ok…need to get to bed…I will report on it tomorrow and mark this as solved fi I get it working. Thanks guys.