# Blend tree for triggers?

I have a hero that can aim his gun.

When the user aims down, I play the animation "gun_aim_lo". When the user aims up, I play the animation "gun_aim_hi".

I do this via a BlendTree.

The "BlendVal" is set by the current mouse position.

float f = Input.mousePosition.y / Screen.height;
_animator.SetFloat("BlendVal", f);


This works fine.

When the user then presses the fire button, the hero shoots his gun.

I play the gun_shoot animation using a Triggger like that:

_animator.SetTrigger("PistolShootTrigger");


However, I have now noticed that I need different gun_shoot animations, just like for the aiming: I need a gun_shoot_hi and a gun_shoot_lo animation according to the aiming position, else it would look strange if the user for example aims low and then the shoot-straight-animation is being played.

I would need to be able to blend between them according to where the user aims when he shoots.

Can I combine a BlendTree with a trigger?

I think I can only trigger single animations, and not a blend tree.

Can somebody tell me how my idea could be achieved?

• I've not got time for a full answer but I'm pretty sure you can achieve what you want using animation rigging, I believe the Unity tutorial video for Animation Rigging covers exactly what you're trying to do, except they do it with a bow, I will provide the link shortly when I find the exact one I was talking about, there are a few! May 15, 2021 at 12:41
• This is a problem which might also be solvable with IK targets. Instead of having different aim points, you just set up an IK point in your character rig which allows the character to aim at any arbitrary height. May 15, 2021 at 12:45
• The Animation Rigging package, allows you to create procedural animations on top of your "pre-baked" animations by manipulating/constraining bones, I cannot find the exact video I was referencing (really annoying) but Unity does provide a way to do this via the Animation Rigging Package, there are a lot of unofficial tutorials too, apologies for not being able to provide much more help or information, it's just something I've done before so I can say it does work, but I do not know the content well enough to explain it to another. Searching "Animation Rigging Unity" is a good place to start! May 15, 2021 at 13:05
• Thank you, you two. I'm trying to perfectly rebuild RE4, and I know that they use high / mid and low poses and blend between them, also for gun shooting, so I would like to stay with my blend tree approach. May 15, 2021 at 14:04