Legacy Camera Shake

Hello, colleagues!

I’m working on a project in Unreal Engine and I want to implement a camera shake (or tilt) effect based on the direction of the character’s movement. Specifically, I need the camera to tilt left or right depending on the direction the character is moving (for example, when moving left, the camera tilts left, and when moving right, the camera tilts right).

I’ve tried using Legacy Camera Shake for this, as it allows me to set shake parameters and camera oscillations, but I’ve encountered an issue. I need to pass parameters (such as tilt direction) to the camera through this system, but I’m not sure how to do that.

My questions are:

  1. How can I correctly pass parameters to Legacy Camera Shake? I want the camera tilt direction to change based on the movement direction (for example, positive values for left tilt and negative for right tilt).
  2. How can I control the shake amplitude to make it dependent on the character’s movement speed (for example, making the camera tilt more strongly when moving faster)?
  3. If Legacy Camera Shake isn’t the best way to implement camera tilt based on movement direction, what other methods would you recommend for this task?

I would greatly appreciate any help or example implementations! Thank you!

1 Like

Hello, @Dev_Erick hope everything is going well!

I don’t recommend using camera shake for specific camera behavior.
Here are two alternatives:

  1. Use the options in the SpringArm component (if you’re using one) to create a camera LAG. This will let you add some “lateral movement”.

This option may not be enough.

If you need more complex or specific behavior i recommend:

  1. Create your own CameraModifier object and assign it to the PlayerController CameraManager

In the player Controller

You can create custom logic inside the camera modifier to tilt the camera.
Instead of passing data to the camera modifier, it’s better to obtain the data directly within it.
This approach keeps the camera modifier autonomous and helps maintain clean and organized code.

Have a good day!.

2 Likes

Thanks, brother, that’s genius. Appreciate the implementation ideas, and have a great day!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.