My solution for UE5 Early Access Camera Shake

If you’re like me you may like tinkering in the new engine to get ahead of the curve for when the full launch is released. So far, I have had 0 issues following the lectures up until this point (honestly I’m surprised).
This lecture is when I first ran into trouble with the camera shake. I’ve seen some say they were able to get it working with MatineeCameraShake, however mine would not compile when using that, so instead I opted for CameraShakeBase (as ClientStartCameraShake documentation indicates the input type should be of type CameraShakeBase). All code would be the same so I will just include what would be different.

in ProjectileBase.h

class UCameraShakeBase;
UCLASS()
...
...
     TSubclassOf<UCameraShake> HitShake;

in ProjectileBase.cpp:

#include "Camera/CameraShakeBase.h
...
...
OnHit(...)
{
   ...
   GetWorld()->GetFirstPlayerController()->ClientStartCameraShake(HitShake);
   ...
}

virtually the same as before, just different class and includes, and still works even if you, in the previous lecture, had chosen to click MatineeCameraShake when choosing the BP instead of CameraShakeBase since Matinee inherits from Base. I have no idea why Matinee wouldn’t work here in C++ since it’s derived from Base, but this is UE5 we’re talking about and it is an unstable build.

Privacy & Terms