Search Unity

An issue with Animator State Machine

Discussion in 'Animation' started by mikhailbond1998, Aug 29, 2019.

  1. mikhailbond1998

    mikhailbond1998

    Joined:
    Aug 29, 2019
    Posts:
    2
    Hi! I have already tried all the methods, but nothing works. So there is a scheme for animations for weapon:

    The problem is that before using the animations, I aimed the barrel of the weapon at the point where the camera was aimed, in order to shoot where it was needed and everything worked fine. Now, when the moment of shooting occurs (these are the states of fire (automatic) and Fire (Single) ), then I also have to direct the weapon to a certain point where the camera is directed. But the problem is that, for example, when switching to fire, the weapon takes the default value of the position, and does not follow the mouse. I tried to make a Behavior script, and in the animation clip itself, including an animation event and just in the scripts in the Update method - but no reaction. As if something is blocking the position of the weapon. What can I do in such a situation? Probably this depends on Default Values, as the weapon returns to its original position, but it does not correspond to the direction of the camera. Is it possible to somehow change these default values in each frame in the scripts?