#shooting animation controller

28 messages · Page 1 of 1 (latest)

earnest wedge
#

i made a shooting animation for my entity but i don't know how to link it to the shooting action in game, there is a particular query i should know of? (help)

royal crypt
#

My reply in #old-entities earlier may not have been too helpful. I think you’ll want to set up the ranged attack behavior to charge before each shot and use q.is_charged or q.is_charging to trigger the animation. Have a look at the vanilla ghast files for an example. You can modify the length of the charge time and cooldown time in the ranged attack behavior.

earnest wedge
#

My entity shoots 3 fireballs at the same time, so i made an animation that makes the mob shoot 3 times in one animation, so i think that the advice you gave me before should work in this case

#

Do You think it will work?

#

Because i cant test now

#

I am a beginner and using bridge so i work with bridge predictions

#

But they dont work in animation controller

royal crypt
#

I’m a notepad user 😅

earnest wedge
#

I'm stuck

#

Yes

royal crypt
#

Blazes shoot a burst of 3 and use a charging animation.

#

You want the animation to play when they shoot, not when charging?

earnest wedge
#

Yes

royal crypt
#

Maybe you could have an animation that runs during charging and then transitions to the shooting based on !q.is_charging.

#

May I see your ranged attack compnent?

earnest wedge
#

Wait a minute

#

"minecraft:behavior.ranged_attack": {
"priority": 3,
"burst_shots": 3,
"burst_interval": 0.1,
"charge_charged_trigger": 0,
"charge_shoot_trigger": 4,
"attack_radius": 25,
"attack_interval": 3.5
}

royal crypt
#

Ok. I’ll play with that with a simple ghast animation to see if my suggestion will work.

earnest wedge
#

you mean this ? query.facing_target_to_range_attack

royal crypt
#

I was going to try

Maybe you could have an animation that runs during charging and then transitions to the shooting based on !q.is_charging.

earnest wedge
#

query.facing_target_to_range_attack could you try this for me and see if the animation works?

royal crypt
#

q.is_charged apparently returns 1 only during the time difference between charge_shoot_trigger and charge_charged_trigger in behavior.ranged_attack. So if you don't need a charging animation then you can use is_charged to transition to an animation at 0.1 seconds before an attack. So where you had charge_charged_trigger at 0 I set it to 3.9, since you had charge_shoot_trigger set to 4.

#

Then I added a "shoot" animation to the ghast that looks like this:

    "animation.ghast.shoot": {
      "loop": false,
      "bones": {
        "head": {
          "scale": {
            "0.0": [4.5, 4.5, 4.5],
            "0.1": [2, 4.5, 4.5],
            "2.0": [2, 4.5, 4.5]
          }
        }
      }
    }```
#

In the animation controller I had the ghast's "scale" controller transition between the default scale and the shoot animation using q.is_charged and q.all_animations_finished.

"controller.animation.ghast.scale" : {
  "initial_state" : "default",
  "states" : {
    "default" : {
      "animations" : [ "scale" ],
      "blend_transition" : 0.1,
       "transitions" : [
          { "shoot" : "query.is_charged" }
      ]
    },
    "shoot" : {
      "animations" : [ "shoot" ],
      "blend_transition" : 0.5,
      "transitions" : [
        { "default" : "query.all_animations_finished" }
      ]
    }
  }
}```
#

So basically q.is_charged starts the shooting animation, and the animation uses keyframes for two reasons: (1) so that it can have a delay for the time between the charging and the actual shot, and (2) so that we can transition back to default using q.all_animations_finished.

earnest wedge
#

Oh mi god