How do i make my gun sway like in call of duty 4?
Answer by FutchProductionsSyndicate
Jun 12, 2011 at 04:36 AM
Use an animation.
Or use gradual motion using the MAthf.lerp function to make it slowly sway from side to side.
But an animation is MUCH easier.
@FutchProductionsSyndicate Thanks man i will try that it makes sense now.
@FutchProductionsSyndicate one more question how do i play the animation while i look to the sides on the mouse?
@Keith18127389 Sorry, i'm not quite sure how to do that. what you could do is a combination of animations and a Lerp.... Have it loop an idle animation of the gun bobbing and swaying, and when you look to the sides, use the Mathf.lerp function to gradually move the gun and rotate it slightly.
I'm not completely sure how that would work with the animation, but I think it should work fine.
Answer by Yanger_xy
Jun 12, 2011 at 04:37 AM
"duty 4 " I haven't played it yet.Can you describe your question in another way?
NOTE TO MYSELF: I should use a comment next time. Not a answer! -- OrangeLightning :)
Please do things like this as a comment, and he means in the game, "Call of Duty 4" how the gun sways side to side and bobs up and down to make it look like you are walking.
Answer by Kieran Chandler
Oct 15, 2011 at 04:14 PM
make it rotate the same way you make the camera rotate. it is simple. one problem you may find is that it begins to move off of the screen. this is simple to fix just use the Mathf.Clamp() function that is how i did it
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
4 People are following this question.
Why does the FPS Tutorial robot walk like a cross?
Gun sway script not working
Urgent! Rotation question!
Why won't this weapon sway script work?
Unity Noob: Unknown identifier error after building project on Android platform.