-1

I tried to implement this effect, similar to this: https://www.reddit.com/r/Unity3D/comments/12kn33e/i_added_camera_tilt_based_on_the_movement_of_the/, using Lerp to smooth out the camera tilts, but was only able to get it working "snappily", ie. without lerp.

How could I get an effect similar to the one on reddit?

lunixd
  • 13
  • 4
  • 1
    Edit your question to provide a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of your code. Also, read [How to Ask](https://stackoverflow.com/help/how-to-ask). – Borisonekenobi Jul 25 '23 at 20:44
  • The phrase you are looking for is probably `Sway` .. checkout e.g. https://www.youtube.com/watch?v=DR4fTllQnXg – derHugo Jul 26 '23 at 08:54

2 Answers2

0

Hard to answer since I have no code, but usually smoothness is achieved by increasing your camera tilt over time, until it reaches the maximum tilt value.

Here's an abstract example of how to do that:

currentTilt += Time.deltaTime * maximumTilt * 2;

Try using it somewhere in your code, may work. If it doesn't - edit your question and add some of your code so I have more info on your issue.

xLisiq
  • 1
  • 4
0

As others have posted you should really post what code you've tried, as per site rules.

The effect you're looking for is probably provided by Vector3.SmoothDamp: https://docs.unity3d.com/ScriptReference/Vector3.SmoothDamp.html

Use it to smooth out both the position and rotation (using Quaterion.Euler).

Absinthe
  • 3,258
  • 6
  • 31
  • 70