c ++ – Calculate the weights of animation according to two variables

I work on a custom engine and tinker animations using the Cal3D library. My previous experience with animations was a bit based on prototyping with Mecanim from Unity.

At the present time, I am trying to implement a character who can be inactive, walk or run and who is also able to point his weapon right, up or down, while doing the same. one of the previous animations. As far as I know, this would require two different variables from which to calculate the weights of each animation, namely the angle of view and the speed of the player.

At first I thought of separating the player's hands and head as a partial animation and doing a 1DBlender (like Unity's) depending on the angle of view to interpolate between three different animations of the arms and the pointing head up, right or down. . Then, for the rest of the body, interpolate with another 1DBlender according to the speed. Although the solution works, I still do not totally agree with this solution because I can not have combined animations for the arms and head based not only on the aiming angle , but also on speed (which would allow me to have things like having the character's head slightly moving by pointing down and running, then head mostly motionless at rest).

My idea was to try to implement something similar to one of the 2DBlenders found in the unit so that I could have 9 animations (IdlePointingDown, IdlePointingUp, IdlePointingStraight, WalkingPointingUp, …) and calculate the weight of each animation according to the two variables that I have. The problem is that I have no idea about how to implement such a mixer. Could anyone give me advice on the pseudocode or the general idea or recommend me a different solution?

Thank you so much.