#Smooth animations for mobs.

1 messages ยท Page 1 of 1 (latest)

cosmic junco
tidal moss
#

If it doesn't work, please ignore my advice.

cosmic junco
#

Quick question

#

What does blend_via_shortest_path do?

#

It said it blends it in a shorter mean, but how does that affect it?

tidal moss
#

emm

#

Normally, rotations can span the full 360-degree range. Without blend_via_shortest_path, the animation might take a longer route to complete a rotation (for example, rotating from 0 degrees to 270 degrees might happen by rotating 270 degrees forward, instead of 90 degrees backward). This could look unnatural or inefficient visually.

However, when blend_via_shortest_path is set to true, the animation system smartly chooses the shortest rotation path. In the example mentioned, it would opt to rotate 90 degrees backward instead of 270 degrees forward, resulting in a smoother and more natural visual effect.

cosmic junco
#

it's because when the attack animation is playing and the entity is moving, the idle animation plays as well

#

let me highlight it

#

{
"format_version": "1.10.0",
"animation_controllers": {
"controller.animation.scp743antgeneral.scp743antmove": {
"initial_state": "default",
"states": {
"default": {
"animations": [
"idle"
],
"transitions": [
{
"walking": "query.ground_speed>0.1"
},
{
"attacking": "variable.attack_time>0"
}
],
"blend_transition": 0.2,
"blend_via_shortest_path": true
},
"walking": {
"animations": [
"walk"
],
"transitions": [
{
** "default": "query.ground_speed<0.1"**
},
{
"attacking": "variable.attack_time>0"
}
],
"blend_transition": 0.2,
"blend_via_shortest_path": true
},
"attacking": {
"animations": [
"attack"
],
"transitions": [
{
"default": "query.all_animations_finished"
}
],
"blend_transition": 0.1,
"blend_via_shortest_path": true
}
}
}
}
}

#

not sure how to make it detect if the attack animation is still playing

tidal moss
#

{
"format_version": "1.10.0",
"animation_controllers": {
"controller.animation.scp743antgeneral.scp743antmove": {
"initial_state": "default",
"states": {
"default": {
"transitions": [
{
"idel": "query.alive"
}
],
"blend_transition": 0,
},
"idel": {
"animations": [
"idel"
],
"transitions": [
{
"walking": "query.ground_speed>0.3"
},
{
"attacking": "variable.attack_time>0"
}
],
"blend_transition": 0.2,
"blend_via_shortest_path": true
},

            "walking": {
                "animations": [
                    "walk"
                ],
                "transitions": [
                    {
                        "idel": "query.ground_speed < 0.3"
                    },
                    {
                        "attacking": "variable.attack_time>0"
                    }
                ],
                "blend_transition": 0.2,
                "blend_via_shortest_path": true
            },
            "attacking": {
                "animations": [
                    "attack"
                ],
                "transitions": [
                    {
                        "idel": "query.all_animations_finished && query.ground_speed < 0.3"
                    }
                ],
                "blend_transition": 0.1,
                "blend_via_shortest_path": true
            }
        }
    }
}

}

#

try this

cosmic junco
#

alright!!!

#

well, I think i've found a better solution

#

i've separated the attack animation

#

and it is working smoothly

#

now, i'm trying to get a flying animation working

#

however...

#

if I used !q.is_on_ground

#

when the flying entity hits the ground it completely skips the blend transition

#

no idea why, and not sure how I could fix it

#

oh wait

#

I didn't change something

#

there we go

tidal moss
#

The code runs from the top down.

cosmic junco
#

Are you talking about the code I just sent or the code you sent...?

cosmic junco
tidal moss
#

"blend_transition": 0.2

cosmic junco
#

Set it to 0.2?

#

Or

#

Move it?

tidal moss
#

yeah

cosmic junco
#

Alrigjt

#

Let me try that

#

Hold on

#

What's paads

#

But yeah, when it's flying the animation is normal until it stops, which you can clearly see the animation instantly transition to idle or walk without any "smooth transition"

tidal moss
#

"walking": {
"animations": [
"walk"
],
"blend_transition": 0.2,
"transitions": [
{
"idel": "query.ground_speed < 0.3"
},
{
"attacking": "variable.attack_time>0"
}
],
"blend_via_shortest_path": true
}

#

like that

cosmic junco
#

Wait what the what happened to my messages

#

Oh

#

Let me try that

tidal moss
#

And you can try to turn up 0.2.

#

"walking": {
"animations": [
"walk"
],
"blend_transition": 0.2,
"blend_via_shortest_path": true,
"transitions": [
{
"idel": "query.ground_speed < 0.3"
},
{
"attacking": "variable.attack_time>0"
}
]
}

#

I usually write code like this.

#

Because the code runs from the top down.

cosmic junco
#

ah alright

#

let me see if this will work

#

didn't change anything

#

still stops the transition when it hits the ground

#

i think I know why...

#

the transition doesn't start because the entity hits the ground before the transition

tidal moss