• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code GM2 - Spine Mixing Animations

Leonardon

Member
Hello,

I am having some issues and I was hoping someone could help me.

My player is on Idle state:

if (skeleton_animation_get() != "Idle")
{
skeleton_animation_set("Idle")
}

When I change it to any other state like "jump" or "walk" the animation looks mixed.

Press "JUMP"
if (skeleton_animation_get() != "jump")
{
skeleton_animation_set("jump")
}

It looks the "idle" state is being executed simultaneously with the other states.

I see the arms are moving like the "idle" however, the legs are moving like the "jump".

When it gets back to "idle" then the player arms are animating on "idle" but the player legs look frozen in the latest animation state.

Player set idle - OK
idle -> jump - LOOKS MIXED
idle -> jump -> idle - LEGS WONT ANIMATE ANYMORE

All bones have keys for Rotation and Translation on FIRST and LAST frame.

I found same issues on the forum but nothing I am doing seems to solve this.

Thank you in advance.

Spine: Verion 3.7.9.1 ESS, Laucher 3.7.82
GM2: IDE 2.2.1.375, Runtime: 2.2.1.291
Spine Export Configuration:
upload_2019-3-9_10-13-4.png
 
Last edited:

Leonardon

Member
Could this be the version of Spine or GM?

How do I run a skeleton animation without mixing to another?

Anybody?
 

Andrey

Member
I always clear the animation stack before installing a new one.
Code:
skeleton_animation_clear(0);
skeleton_animation_set(anim_name);
 

Leonardon

Member
Thank you, @Andrey
I didn`t find this clear on the documentation.
I do some tests and get back with the results.
I assume track 0 means the first animation on Spine (from top to bottom)?
 

Leonardon

Member
Thank you for your help.

Unfortunately this is not working.

I created a new object and the code below for testing purpose.

The animations still won`t start as it should. Some bones remain frozen while just the arms...

Every bones are set to translate, rotate and scale on FIRST and LAST frames.

Not sure how to fix this...

Code:
var j = keyboard_check_pressed( vk_space)
var l = keyboard_check_pressed( vk_left)
var r = keyboard_check_pressed( vk_right)
var i = keyboard_check_pressed( vk_f1)


if (i)
{
    if (skeleton_animation_get() != "Idle")
    {
            skeleton_animation_clear(0)
            skeleton_animation_set("Idle")
    }
}

if (j)
{
        if (skeleton_animation_get() != "Jump")
        {
            skeleton_animation_clear(1)
            skeleton_animation_set("Jump")
        }
}

if (l || r)
{
        if (skeleton_animation_get() != "Walk")
        {
            skeleton_animation_clear(2)      
            skeleton_animation_set("Walk")
        }
}
 
Last edited:

Andrey

Member
no, everywhere skeleton_animation_clear(0)

Code:
var j = keyboard_check_pressed( vk_space)
var l = keyboard_check_pressed( vk_left)
var r = keyboard_check_pressed( vk_right)
var i = keyboard_check_pressed( vk_f1)


if (i)
{
    if (skeleton_animation_get() != "Idle")
    {
            skeleton_animation_clear(0)
            skeleton_animation_set("Idle")
    }
}

if (j)
{
        if (skeleton_animation_get() != "Jump")
        {
            skeleton_animation_clear(0)
            skeleton_animation_set("Jump")
        }
}

if (l || r)
{
        if (skeleton_animation_get() != "Walk")
        {
            skeleton_animation_clear(0)    
            skeleton_animation_set("Walk")
        }
}

And, do you reset the animation to the beginning of the frames each time you reassign? After all, the keys to all the bones in the first and last frame.
 

Leonardon

Member
No Lucky...
How do I reset the animation to the beginning?

The documentation says skeleton_animation_set does that... Is there any other way?

Yes all bones have keys set on first and last frame.

I guess this is isolating to my Spine animation or it is a big on the softwares version I am using.

I will start new animations on Spine again...

It has been like 3 weeks water of time on this... :(

Thanks for your help
 

Posh Indie

That Guy
I played around with Spine in GMS2 a while back. I had the same issue you are having. I solved it by locking all the bones on the first frame of the animation itself within Spine (Lock all bones in the initial pose). I am by no means a Spine expert, though, so this is probably not an "end all" solution.

I think the reasoning behind this is actually intuitive, though, as if you make animations for the lower body, and animations for the upper body, you can actually play them in different combinations to achieve more animations from less animation work.

An example would be running with a weapon in hand. If you make the running animation for the lower body and then if you make the upper body animation for running, running with a sword, and another for running with a gun, you can play the running animation and just activate the necessary upper body animation based on context (keeping the legs running between them seamlessly while switching between no weapon, a sword, and/or a gun). This, then, allows your animation system to be as manual or procedural as you wish.
 

Andrey

Member
No Lucky...
How do I reset the animation to the beginning?

The documentation says skeleton_animation_set does that... Is there any other way?

Yes all bones have keys set on first and last frame.

I guess this is isolating to my Spine animation or it is a big on the softwares version I am using.

I will start new animations on Spine again...

It has been like 3 weeks water of time on this... :(

Thanks for your help
I use the following animation code:

CREATE EV
Code:
anim_speed = 1 / 60;
anim_name = "anim_name_spine";
skeleton_animation_set_ext(anim_name, 0); // set the animation in slot 0
anim_time = skeleton_animation_get_duration(anim_name); // get a long animation
anim_current_time = 0; // playing time of the current animation
STEP EV
Code:
// playing an animation
if(anim_current_time + anim_speed < anim_time - anim_speed)
{
    anim_current_time += anim_speed;
}
// if the animation has come to an end
else
{
    anim_current_time = 0; // reset time of the current animation
}
DRAW EV
Code:
draw_skeleton_time(sprite_index, anim_name, "", anim_current_time, x, y, 1, 1, 0, -1, 1);
 

Leonardon

Member
Thanks for all the replies.

I will remake my animations again on Spine.

It will also do some tests with the code @Andrey posted which seems to manage the animation timing and frame.

Not sure this should really be necessary as per the documentation the skeleton_animation_set("Walk") should reset the animation to frame 0.

Well... I will post some results soon.

Thanks
 

Leonardon

Member
No Lucky.

I re-started the spine animation and when I loaded into GMS2 I noticed these notes:

Unhandled spine attachment
Unhandled spine attachment
Unhandled spine attachment
Unhandled spine attachment
Unhandled spine attachment
Unhandled spine attachment

How can I find out more about this?
 

Leonardon

Member
So this seems to be a slot with hidden images, right?

I will ignore this for now... I do have a slot for Weapons and the player can have no weapon.

Thanks.

I will continue the tests and post the results...
 

Leonardon

Member
No lucky.

I deleted the animation on Spine and started again.

I made two animations: idle and jump

They both start with all bones set to keys on first and last frame (for translate and rotate).

When changing states the legs of the player wont get back to its initial position set on frame 1 (or simply it won`t animate correctly).

The code on GMS2 is as simple as:

STEP
Code:
if (keyboard_check_pressed(ord("P")))
{
    state = playerState.jump
}

if (keyboard_check_pressed(ord("O")))
{
    state = playerState.idle
}
Draw
Code:
switch(state)
{
    case playerState.idle:
        if (skeleton_animation_get() != "Idle")
        {
            skeleton_animation_set("Idle")
        }

    break

    case playerState.jump:
        if (skeleton_animation_get() != "Jump")
        {
            skeleton_animation_set("Jump")
        }
    break   
}
Can anybody help please?
 
Top