Hello!
I've been scratching my head with this one for quite some time. I have a large NPC character, that follows player. How can I make the screen shake when this character is moving? The shake should stop when the character is standing still.
What would be the easiest route to achieve this?
Comments
A shaking effect can be triggered at any time with the Camera: Shake Action. Place this in an ActionList asset, and set the asset's When running field to Run In Background. You can then call this whenever needed to shake the screen without interrupting gameplay.
In order to have the screen shake in time with the NPC moving, you should be able to do this with animation events that are embedded in the NPC's walk animations. While you could do it in a custom script, that would be the easiest way to time the shaking properly with the footsteps.
An event or script that invokes the ActionList asset's Interact() function will cause that ActionList to run.
It seems they can only call functions that exist on the same GameObject as your Animator - so you will need to place the Actions in a Cutscene component placed on the same object. Setting the When running field to Run In Background is still important, however.
If you want to have multiple animation events that each run a different set of Actions, you would need to instead place a simple intermediary script on the GameObject, that can be used to run different ActionList assets based on a parameter supplied in the Animation Event.