#..
1 messages · Page 1 of 1 (latest)
wait i have the same problem, this is my ac
lemme paste it then
u mean put an query in attack right
im not an expert in this
oh u mean the ac folder right
sorry to bother you but this is my ac for attack
"initial_state" : "default",
"states" : {
"attacking" : {
"animations" : [ "attack.rotations" ],
"transitions" : [
{
"default" : "variable.attack_time < 0.0"
}
]
},
"default" : {
"transitions" : [
{
"attacking" : "variable.attack_time >= 0.0"
}
]
}
}
},```
how to add the query to it
I wanna see if you can figure it out first before I tell you.
y'know, like the old saying, "give a man a fish, teach a man to fish".
Controller animations define when you use an animation.
initial state will be the first state that your entity goes to.
As your intitial state is "default", your controller animation will start there.
Since there is no animations in default, nothing will happen.
Your other animation state is "attacking".
That state has an animation called "attack.rotations", so when your current state is "attacking", the "attack.rotations" animation will play.
To get from the "default" animation state to the "attacking" animation state, it has to transitition there. That's what the transition section is for.
Transitions tell you what has to happen in order to change from one state to the other.
So with all that said, where do you think you should put "query.has_target"?
alright im looking through the docs too lemme see if i can do this
i think ill put it in the transition to attacking
yep, that's correct
"transitions" : [ { "attacking" : "query.has_target" } ]
And once you're in the "attacking" state, you'll want to be able to go back to the "default" when there is no longer a target, which means the opposite of "query.has_target".
You use "!" to get the opposite of a query, or if there is 0 of something.
So you use "!query.has_target" for the transition to default. @hollow gulch
i see, and do i still need the variable.attack_time in both transitions like with && @shadow kettle
You don't need it for your purposes. You said you want your character to do the attack animation all the time so long as it has a target to track.
variable.attack_time is just a variable that activates when a mob is attacking.
So when a mob is attacking, the variable number goes up, and when the number is greater than 0, it transitions to the attacking state.
When a mob is no longer attacking, the variable goes back down to 0, meaning it transitions back to default.
i did wat you told me to, but i still dont achive it, here is the video and the animation controller for it
"initial_state" : "default",
"states" : {
"attacking" : {
"animations" : [ "attack.rotations" ],
"transitions" : [
{
"default" : "!query.has_target"
}
]
},
"default" : {
"transitions" : [
{
"attacking" : "query.has_target"
}
]
}
}
}```
Might have to do with the fact that you're using attack.rotations rather than your own attack animation.
If this is the vanilla Minecraft's attack.rotations, then that animation uses math related to the variable.attack_time.
Make your own attack animation that looks close enough, and set the animation to loop.
..
ok so i kinda have an attack animation similar to player's attack animation, here it is
"loop" : true,
"bones" : {
"body" : {
"rotation" : [ 0.0, "variable.attack_body_rot_y", 0.0 ]
},
"leftarm" : {
"rotation" : [ "-(math.sin((1 - math.pow((1 - variable.attack_time), 4)) * 180) * 1.2 + math.sin(variable.attack_time * 180)) * 10.0", 0.0, 0.0 ]
},
"rightarm" : {
"rotation" : [ "-(math.sin((1 - math.pow((1 - variable.attack_time), 4)) * 180) * 1.2 + math.sin(variable.attack_time * 180)) * 30.0", "-(math.sin((1 - math.pow((1 - variable.attack_time), 4)) * 180) ? (-90.0 * math.sin((1 - math.pow((1 - variable.attack_time), 4)) * 180)) + 30.0 : 0.0)", 0.0 ]
}
}
},```