Camera Shake When jumping

i would like the camera to shake a little bit when you jump, here’s my code editor, so you can look at my jump code and tell me what to add to get that effect
https://playcanvas.com/editor/code/928047?tabs=82548128

Hi @Deadshot1m24! Below a project with camera shake. I think you can figure out yourself how to activate it when the player jumps.

https://playcanvas.com/project/439297/overview/explosion-particle-effect

i dont really understand this, it isn’t a single play thing. It automatically plays which makes me unable to pick out a specific part, to kinda peice together a jumping thing? I am very confused

I will create an example when I have some time.

1 Like

okay thank you for your help and appreciation

I checked the example project and saw that the camera shake is started from the other script in the project. That means, if you only add the camera-shake script to your own project, nothing happens. To activate the camera shake, you need to fire the event below somewhere in your jump function.

this.app.fire("camera:shake");
1 Like

so this line will do the camera shake for me, i just have to jam it into the jump code somewhere

okay now the difficult part is finding where to jam it into…

Just where you do your jump. Don’t forget to apply the camera-shake script to an entity as well.

1 Like