Camera Shake For A Shooter

I was wondering if it is possible to code some sort of camera shake with movement.

a few of my classmates wanted me to make a first person shooter and the first thing i thought of was camera shake, so when thing like explosions happen, or if you hit the ground a bit too hard, the camera will jostle a bit, is it possible?

Hi Mason,

No, this isn’t currently possible, but there is a web API for this: Vibration API - Web APIs | MDN so the CoSpace developers (@Stefan) could potentially hook into this IF the CoSpace is being viewed on a mobile phone or device which allows haptic feedback.

Geoff @ TechLeap

Hi @PaintIsMyFavBeverage,

There are multiple ways to achieve a camera shaking motion. One approach is to create haptic feedback as mentioned by @techleapnz, the other is to create a short burst of movement on the camera item itself. You can create such motion in scripting, though keep in mind that this can be a complex creative coding challenge :slight_smile:

Below is a remixable space that demonstrates the use of scripted motion generators in different contexts. The first scene shows how you could trigger a camera shake when it collides with special items such as the ground.

Hope this helps!

1 Like

Doh! On 2nd read, I see @PaintIsMyFavBeverage just wants camera movement, not phone movement. That’s me taking things a little too literally… :joy:

Glad you got your eyes on this, @Stefan!

An alternative is to attach the Camera to the head of a character (which you could make transparent) and fire off an animation when something happens. This does require coding movement for that character though.

You can also just use CoBlocks to get a basic shake:

Geoff @ TechLeap