Camera Shake via booms.
So unlike the Pulse bomb, the camera shake is extremely simple to pull off. Either in Editor with an animation, or in code with a Coroutine.
open your camera, add an Animation component. Have the camera shake across the X axis as shown above in the animation window. (Note that the X Axis flows between 0 and 1)
Get cameron mcleod’s stories in your inbox
Join Medium for free to get updates from this writer.
Once that’s done, ensure that the entry is pointing to an empty game object. Add a transition from the empty object to the Shimmy animation, and have it be triggered by the Shimmy trigger.
Once that’s in, let me show you the smallest complete code file I’ve ever written.
using UnityEngine;
public class CameraEffects : MonoBehaviour
{
Animator _animator;
private void Start()
{
_animator = GetComponent<Animator>();
}
public void DoCameraShake()
{
_animator.SetTrigger("Shimmy");
}
}This could be shorter, but as of writing this article, this code is complete. Adding it and attaching it to your camera will complete the camera shake.
Happy Coding!









