Someone asked for details on the camera shake implementation - I got started with this post: Camera Shake question - UE4 AnswerHub
First I created a new Blueprint based off the CameraShake class, and changed a few values in the Defaults:
I compiled and saved that blueprint (as “BP_CameraShake” which we’ll need to reference in a later step).
Then I opened my “MyCharacter” blueprint (this is created automatically with a New Project based off the Blueprint First Person template), and created a “Play World Camera Shake” node to be triggered on Event Tick, with the “Shake” input dropdown set to my “BP_CameraShake” blueprint I created earlier, the Epicenter input set to my current player location, and the Falloff input set to a range based on whether the player was moving or stationary (since I want a more exaggerated shake while moving, but still a small “baseline” shake while standing still).
Coming up with the right Falloff is a little complicated, since it seems to adjust the curve that scales the BP_CameraShake class’s values based on the distance from the Epicenter to the camera you wish to affect, where Inner Radius is 100% shake, and Outer Radius is 0% shake. In my case, my Epicenter is always set to the center of my player’s collision capsule (the location returned by the Get Actor Location node), and my camera is vertically offset from this point by 64. Again, this is the default setup when using the Blueprint First person template when creating a new project:
I’m definitely not doing this optimally ;), but considering my target camera is 64 units from the Epicenter, and I’m using an Inner Radius of 0, and an Outer Radius of 150, my shake is always scaled to roughly the middle of the curve defined by Falloff (100 / 150 * 64 = 42%). Where this falls on the curve I haven’t really visualized, but I get pretty close to desired results (using the above Camera Shake class values) by generating a Falloff range of 1.0 - 3.5, where the lower Falloff value (1.0) is more shake, and the higher Falloff value (3.5) is less shake. When I don’t offset the Falloff input by 1 (instead generating a range of 0.0 - 2.5), I get pretty strong shake both moving and at rest, and not as much difference between the two. And when I get a Falloff input a little higher (say 4.0 or so), the shake disappears completely.
Here’s my camera shake setup inside my “MyCharacter” blueprint, running on every Event Tick:
I’ve created the variables MoveForward, MoveRight, MouseTurn, and MouseLookUp, which are used here as modifiers to create a Falloff input for the camera shake. These are set by modifying the pre-existing Input sections of the “MyCharacter” blueprint to save the mouse and movement inputs to these variables:
Sorry for my completely hopeless lack of math skills, but I continue to be amazed at how much I can accomplish with blueprints alone. Hope this helps!