How do I make a model bob up and down when I move forward?

I have been coding in Unity for about a month now and I’ve come to a stage where I have no idea how to do something.

I need to make the gun the character is holding bob(move up and down) a little bit when I control the character (going forward).

Thanks, I’m coding in C# by the way :stuck_out_tongue:

Nexus

theres many ways this can be done, probally the easyiest and most common would be to create an animation cycle and call it whenever a certain key is held.

Or you can program a bob function that moves the model around and is executed when moving.

I agree with Matt. Doing that programmatically would be a LOT more work than just making an animation that moves it up and down.