Search Unity

Sync Shooting Animation and Code

Discussion in 'Animation' started by Terminus001, May 2, 2021.

  1. Terminus001

    Terminus001

    Joined:
    Nov 1, 2015
    Posts:
    121
    Hi everyone,

    I have an issue regarding merging animations and code when dealing with weapon recoil and shooting.

    My setup is the following:
    bullets spawn according to an animation event triggered at a specific frame during the shooting animation of my gun. I already do not like this because it means that if I want to increase my fire rate, I have to increase my animation speed.. which ends up looking unnatural. However, if I decouple animations and code and I let the code handle fire rate and shooting, then shooting animations will not play in sync with my bullets being shot.. also bad.

    Does anyone have a better approach? What I am doing works, but I don't like it, it is not a good solution and I want to improve it.