Trying to get my gun to use the additive animation system in Unity, however nothing happens when the animation is triggered so I must be doing something wrong.
The AnimationController has three layers, Slide, Trigger and Magazine:
All three layers are set to additive, hence the A next to the cogwheel.
Each layer has the animation nodes which move that specific part of the gun, so the Trigger has a TriggerPulled and TriggerReleased animation node. The TriggerPulled animation simply pulls the trigger as if a person tried firing the gun, and TriggerRelease releases it into its default transform. The nodes for the Trigger looks like this:
The transition parameters for each transition going to a animation node is simply a trigger representing the state of that animation node. In this case the triggers are called triggerPull and triggerRelease. The transitions going from a animation node to the Idle node has no parameters.
The transitions from a animation node to the Idle node has exit time checked, but the ones going from Idle to a animation node does not.
The script is pretty simple:
using UnityEngine;
public class WeaponAnimTesting : MonoBehaviour
{
Animator animatorComp;
private void Start ()
{
animatorComp = GetComponent<Animator>();
}
private void Update ()
{
if (Input.GetKeyDown(KeyCode.H))
{
animatorComp.SetTrigger("triggerPull");
}
else if (Input.GetKeyDown(KeyCode.J))
{
animatorComp.SetTrigger("triggerRelease");
}
}
}
What am I doing wrong?
EDIT:
More information was requested, so will add them here.
The rig inside of Blender looks like this:
And in Unity the rig hierarchy looks like this:
When previewing the TriggerPull animation in Unity it plays fine:
The Unity inspector of the pistol object looks like this:
Moving the bones in Blender is also working like it should (afai)
Here are all 3 layers in the AnimationController for the pistol: (only 1 is actually used)