Hello,
I’m currently working on a first person shooter game and recently I ran into a problem with the animations which I can’t seem to find a working solution.
There’s a thing in my game where when I’m holding my right mouse button the weapon positions in front of the camera for aiming down Sight, the problem is that most of the weapons have an Idle animation that constantly plays if no other animation I ls played so when I’m aiming I’m stopping the animation, but the stop() function stops the animation exactly as it is and doesn’t return the object go it’s original state which is what I want.
I’ve already thought of making a new animation with only one frame just so it will reset the object to it’s original state but it will take alot of time to set the keys for all the children and do it for all of the guns will take time…
So I’m open to any segestions thanks in advance to all the help you guys will give me!
Can you show the animator window with the states and transitions?
I said in the title that I’m using the animation component and not the animator
Doh - whoops. Sorry - can’t help there.
It’s fine. Thanks anyway, anyone else?
I’m having the same problem as this and I’ve searched quite a bit. According to the scripting reference:
"Stops all playing animations that were started with this Animation.
Stopping an animation also Rewinds it to the Start."
However when I use the command GetComponent().Stop, the animation stops exactly where it is.
I’ve found results in searchers to previous versions where this was a bug but supposed to have been corrected by now.
I had a similar issue and found a workaround. Duplicate the animation clip that you want stopped at the first frame, remove all the keyframes except for that first frame and call it something like “startFrame”. Make sure it isn’t set to loop, then just trigger that in Play().