A downloadable tool

Download NowName your own price

Unity asset made for Toolbox Jam!

Wanted to make a little asset for doing screenshake and kickback, since every project can use it, I guess. It works with other camera movement scripts and shouldn't interfere with a moving camera.

Docs:

After being imported into Unity, the "Screenshake" or "Kickback" components can be added through the component menu. (Component > Utility)

On cameras, you can call Camera.Shake();

Or Camera.Kick(Vector3 direction);

You can also call these on cameras that don't have the components attached, and they will be added at runtime. The benefit of adding them to a camera manually is that you can control the variables and do specific effects.

(You can add these to normal objects too, just don't mind that the asset is called "Screenshake". You'll have to call Screenshake.Shake() or Kickback.Kick(Vector3 dir) which sounds kinda weird, but it works.)


Camera.Shake(); will make the camera shake!

Camera.Shake(float multi); will multiply the strength when making the camera shake.


Kickbacks have similar implementation.


Camera.Kick(Vector3 direction); will have the camera get kicked back in that direction! The direction will be a normalized value.

Camera.Kick(Vector3 direction, float multi); also with an optional multiplier


Got any more ideas for this? Lemme know! I'm trying to figure out if this is the best implementation for a quick screenshake asset. Also could use a better, more generalized name! And better example pics. And real docs, oops


changelog:

v1.0

  • no longer uses screenshot data file.
  • curves initialize more usefully.

v1.1

  • relative rotation to camera toggle.
  • way to control screenshake axises

More information

Published194 days ago
StatusIn development
CategoryTool
Rating
(3)
AuthorKaiClavier
Tagsscreenshake, unity-asset

Download

Download NowName your own price

Click download now to get access to the following files:

Screenshake v1.1.unitypackage 12 kB

Comments

Log in with your itch.io account to leave a comment.

thanks

Hey,
looks great but I'm experiencing an issue. I attached a Screenshake script to my Main Camera, and when there is an explosion ingame I call my gamecontroller, which invokes Camera.current.Shake();

On 2/3 of the explosions it works, but sometimes it doesn't and I get the following error:

NullReferenceException: Object reference not set to an instance of an object
ScreenshakeCameraExtentions.Shake (UnityEngine.Camera cam) (at Assets/Clavian/Screenshake/ScreenshakeCameraExtentions.cs:9)
GameController.Explosion () (at Assets/Scripts/GameController.cs:51)
DestroyByContact.OnTriggerEnter (UnityEngine.Collider other) (at Assets/Scripts/DestroyByContact.cs:34)

Line 9 of ScreenshakeCameraExtentions does this:

Screenshake shake = cam.transform.GetComponent<Screenshake>();

Any idea why it's failing to get the Screenshake component?

Hey!

Looked into it, and the problem seems to be that Camera.current is meant for low-level render control, only: https://docs.unity3d.com/ScriptReference/Camera-cu...

Instead of using Camera.current, try using Camera.main or a public Camera variable!

With Camera.main it works like a charm :D

Thanks for the hint and for the asset!