hey guys i want to add bobbing and swaying effect to my character while its crouching too
im a newbie for camera coding and i cant solve this problem ive tride with changing the hipheight but the caharcter floeats on air for a short time and that causes bugs when spammed so ive came with this choice but i dont know how to do ive tried lerping it kinda worked for run and walk but crouch is problem that ive cant solve
You have to understand a little bit of math that’s going on here: sines and cosines.
Sine waves, are, well, sine waves. Simply, they are waves that go up and down forever. Cosines are the same as sine waves except they are offset. If you combine the two, it can create some cool effects.
The code itself uses these functions to create camera sway by basing it off the time. However, you will need to multiply this value (or the time) by the speed of the character to get it to work effectively instead of just swaying endlessly.
You can change Camera.CameraSubject to the part that you want the camera to follow.