- Home /
Animation plays at original position?
I have a aim downs sights script and a gun fire animation , it works fine but the only problem is when i aim down sights and shoot the gun goes back to where i originally animated in , what i mean is that the gun goes back to its "Hip" position - to the side of the screen where it should be when NOT aiming down sights. i am absolutely clueless on what to do and i've done a LOT of research and I've look at forums , youtube and more stuff like that but nothing is helping . What should i do? *If you need a specific code i can give it to show you
Code should help because it should stop animation at last frame but do you have code something like this?
var ai$$anonymous$$g = false;
function Update() {
if(Input.Get$$anonymous$$eyDown("Fire2") && ai$$anonymous$$g == false){
ai$$anonymous$$g = true;
animation.Play("aim");
}
if(Input.Get$$anonymous$$eyDown("Fire2") && ai$$anonymous$$g == true) {
ai$$anonymous$$g = false;
animation.Play("hip");
}
}
if that won't work, send me the code and I'll have a look.
Answer by jorjdboss · Jan 17, 2014 at 06:58 AM
Create a parent object at the same position as gun and attach the gun as child. Add the aim down sight animation to the parent and remove it from the gun. You may want to have a separate fire animation for iron sights because the recoil is less compared to hip fire. You can play the aim animation forward or reverse. Depending on your aim state you would want to switch between the fire animations. Hope this helps
i dont have 2 animations i have one animation , and that was from the hip ... let me try that if that doesnt work ill make an animation in a separate program
If you aren't shaking the gun too much like for example in BF3, then you should be fine with one animation. If you want the gun to You might want to move through the keyframes manually depending on the amount of time fire button is held and swiftly back to frame 0 when released.
Your answer
Follow this Question
Related Questions
Making an animation start when my gun fires 2 Answers
Can someone help me with my script? 0 Answers
Climb animation is glitchy and isnt working properly 0 Answers
Shooting & Animation Problem 1 Answer
machine gun js timing 1 Answer