Language

Pose to pose animation blended with controller trigger input

I see a lot of similar questions with no answerer, so this may be nothing more then clutter that is ignored by the experienced devs, but I have to try as days of research have left me stumped.

I am trying to get a script that will get the vector one value of a game controllers physical trigger button and translate that value to the rotation of an object for smooth motion that tracks the controllers input. In other words, if the controller trigger is depressed 50% the game object should rotate 50% between a minimum and maximum value. For Example if I pull the trigger on my controller and if the game object is a gun with a trigger then the in game gun trigger should move in relationship to the real world controllers trigger.

The way I am going about this is by creating two animation clips that hold static poses (Keyframes) . I am trying this rather then getting the objects rotation as I have multiple moving parts not just a single trigger as suggested in the example above. So I take these animations. One that has identical Clamped Auto keyframes at 0:00 and 1:00 and another that has its own identical keyframes. (I hope this is making sense) These two animations are put into the Animator with transitions pointing at one another. So far I think I have done things right but I'm new to all of this so...

Next its time to write a script that will see the trigger input and link that to the blend tree (I think that's what I have made in the Unity Animator, but like I said this is all fairly new to me.)

I set some properties to be played with in the inspector

public BlenderSets type;
[Tooltip("Place a static animation clip in the 'From' and 'To' feild to belnd between them with your trigger.")]
public AnimationClip From;
public AnimationClip To;
[Range(0f, 1f)]
[SerializeField]
public float influence;
public float smoothingSpeed = 0;

And I try to access the properties using Steam VR 2.2 input system (That's its own can of worms)