How to implement custom C++ camera shake

I want to get the direction based on the position of the monster when it attacks the player and the player’s position, and then generate camera shake based on the direction. However, I found that Unreal Engine’s camera shake can only be written individually in the blueprint, and cannot be customized at all. Please help.

Yes, you can. There is UCameraShakeBase. Also, take a look at this document on how to customize camera shake.

1 Like

Seeing a Bojan already beat me to UCameraShakeBase I would highly suggest looking into the GDC video on camera shake if you are planning on a custom effect.

There is a good explanation of what type of shake works well with different situations / genres.

1 Like

Is there a C++ example, in C++ even if you change the value of the variable and then use PlayCameraShake you still call the DefaultObject(Shake is 0)

Perhaps “Start Camera Shake from Source” with your derived class would do the trick?
obraz

1 Like