Location

Houston, TX USA

Contact

jonathangorr@gmail.com

+1 (754) 423-4462

Follow

  • github

©2017 by Jonathan Gorr.

Nuclear Throne-style Camera Follow and Shake.

September 1, 2017

I've recently been recommended this excellent top-down roguelike shooter, Nuclear Throne, available on Steam. It has a very nice camera shake functionality that I would like to share my Unity3d(C#) recreation of.

How [I think] it works

 

It takes the world or screen position of the player and that of the cursor/mouse, subtracts them then normalizes them to create a 2d vector by which they offset the camera's position on the x and y axes. The intensity of the explosion or gunshot determines the intensity of the displacement.

Here is a standalone version of the shake code:

I also provide below a more complete script that includes target follow functionality.

Please reload