#Animation controllers
13 messages · Page 1 of 1 (latest)
It depends on a multitde of factors.
If you are using a normal melee attack behavior, you would likely want the walking and attacking animations to be in separate controllers. The mob would continue to move and pathfind while it performs melee attacks, and if you had a walking state and an attacking state in a single controller then the mob would stop playing its walk animation to perform the attack animation.
Whether you need controllers at all depends on how the animations are built too. For keyframed animations a controller would work best—purely Molang animations probably don't need controllers.
Both animations for the entity are purely key framed with no variables at all, so how would I make one play when attacking and the other when walking?
Oh and, yes, I am just using the standard melee attack behavior. I just don’t know how to activate the animation at that time
Sorry for the delay with responding.
All mobs have a built-in variable that records how long they have been attacking for, named variable.attack_time. You can use this to play an attacking animation when the mob attacks
Here is an example of what that might look like:
{
"controller.animation.mob_attack": {
"states": {
"default": {
"transitions": [
{
"attack": "variable.attack_time > 0"
}
]
},
"attack": {
"animations": [
"attacking"
],
"transitions": [
{
"default": "variable.attack_time == 0 && query.all_animations_finished"
}
]
}
}
}
}
@cloud pulsar
If you are wanting only one to be played at a time and not combine, you can throw the walking animation into the default state
I’ll try this when I can get back to a computer
It will work with the behavior minecraft:behavior.melee_attack?
yes