Shaky Cam Implementation

Hello fellow PlayCanvas developers!

I was wondering if someone already programmed a sort of “Shaky Cam” like when a camera is hand-held. This would be something great for game-developing and I couldn’t find any examples on play Canvas. I’ve tried to use some Unity examples, but couldn’t get anything to work properly.

Was thinking of a Script which does that independently. For example I have a script where a Camera follows a Path and I add the Shaky Cam script and “poof” my camera additionally shakes while following the path.

Any Help is appreciated!

Do you have a video of what kind of shake you are looking for? There’s a camera shake effect on the explosion VFX in the tutorials section.

Bare in mind that if you have one script already changing the position of the camera (like the one in your example of the path follow), it will conflict with any other script that tries to change the position as well.

You would have to do some nesting of entities to get it to work correctly. Eg have the camera as a child of an empty entity. The path script moves the camera parent while the shake script changes the camera’s local position.

Thank you for the reply!

I was thinking of something like this: https://www.youtube.com/watch?v=qNH0bjI_37U&feature=youtu.be&t=155

Also thanks for the tip of checking out the VFX tutorial. I see, that it has camera shake, but it’s just a dislocation of the camera, do you think it would have a similar effect like the Video I shared, with the parameters tweaked correctly ? I was thinking about it needing to be a lot smoother, because if you set the interval higher, you can really see how the camera just jumps, it doesn’t look like that in the Video.

And for the future, already thanks for the tip with the Child and Parent entity, that was something I was thinking of too.

I managed to get a little something together, but I am not really happy with it…

Looks like it is interpolating between points. Both the look at position and the camera position seem to be changing in the video. You can still use the code from the VFX example but rather than changing the position immediately, move towards it over time.

Hey @yaustar thank you for this post.it helped as I came across same issue. Something like I made camera to follow player Entity and I have added shake effect for camera when player collides with Moon entity but it seems to give me wrong results while shaking.
Now I fixed it by adding parent to camera Entity & moving parent along the player & added shake effect for actual camera.
Thank you