I've found out that in first half-life there are only two animations for making player aim up and down, so at the end, they just blend between them and that makes character aim at the center. I tried to do something like that myself as well, but I failed by getting some weird results
Here are the screens of the positions:
aim up:
aim down:
So what I want now, is to blend between those animations, and make character aim straight forward.
I used to blend between three animations, when my model had additional "aim_center" animations..
But I need to do this without a third animation, I wonder maybe someone has an idea.
Here is the code I try to use currently:
function blend_test(){
// aim at the center:
my.skill5 = 50;
// main loop:
while(1){
// rest animations:
ent_animate(my, NULL, 0, 0);
// go throw the animations:
my.skill2 += time_step * 2;
// blend between animations via Q and E keys:
my.skill5 += key_q - key_e;
my.skill5 = clamp(my.skill5, 0, 100);
// if skill5 is less than 50 % then we aim up:
if(((50 - my.skill5) * 2) > 0){
my.skill3 = (50 - my.skill5) * 2;
}
// if skill5 is more than 50 % then we aim down:
if(((50 - my.skill5) * 2) < 0){
my.skill4 = abs((50 - my.skill5) * 2);
}
// blend animations:
ent_blendframe(my, my, "aim_up", my.skill2, my.skill3);
ent_blendframe(my, my, "aim_down", my.skill2, my.skill4);
wait(1);
}
}