- Home /
FPS Advance Gun Script
I really want to know if there is way to achieve a gun movement like in avert fate. every time i see a tutorial its missing this component. When ever you move your mouse the just follow the movement without any damping or bobbling and its always a static movement not like in avert fate when you move your mouse fast the gun actually goes off screen and then come back to its position it appear more realistic rather than FPS tutorial that would just give an static gun. and yes i have tried the head bobbling script on unifywiki but thats not what i want. I want my gun to bobble when i just move my mouse and not just when i am moving my player.....
So is there anyone with a solution...
Answer by The_r0nin · Dec 16, 2010 at 02:04 PM
Well, assuming (with the little information you provide) you have your gun model either as an object parented to your primary object or that you have your gun as a bone in your armature (otherwise, you can' move it independently, anyway). Use the code in the head-bobbing script and the code in THIS script to get an idea of how you would rotate the bone/object that is your gun to follow the camera. Then you simply add a SLerp or MoveTowards (see the Mathf or the Vector3 class in the documentation) and the gun will lag slightly behind. Add a small random vector3 to the direction that you are trying to move towards and you'll get the "wobble" you want.
Your answer
Follow this Question
Related Questions
First Person Controller 1 Answer
Avert Fate Style FPS Gun Script 3 Answers
FPS gun movement 1 Answer
Reload help 1 Answer