Download

Having camera shake affect bullet trajectory

I am able to get my camera shake to affect the camera, but I’m not able to get it to affect my weapon’s bullet trajectory. I have tried both WorldCameraShake and ClientPlayCameraShake. The camera shakes, but my bullets still fire as though the gun was being held perfectly still.

For spawning my projectiles, I have a server-side RPC that takes in the transform to fire from the client:

The generation of that transform happens like this:

Finally, here’s me playing the camera shake. I’ve also tried WorldCameraShake, like I mentioned:

Any ideas? I did some experimentation yesterday and I believe I found that the camera shake wasn’t actually moving the camera rotation values, even though it quite obviously was shaking violently in the game. I’m not sure though. I think at one point if I removed my setting for my camera to match my controller rotation it seemed to do something, but that completely breaks the gameplay for me. I was hoping doing this via the GetPlayerController and ClientPlayCameraShake would fix that, but it didn’t seem to.

I ended up removing the camera shake altogether and going with modifying the controller via AddControllerPitchInput. As far as I can tell, the camera shake node does not actually change the camera’s rotation or position at all. Perhaps it’s doing some effect on the internals of the camera. I have no idea.

Yeah it’s just an effect. great for earthquake, ragdoll etc kinda things. AddControllerPitchInput is what I’m using. I have a struct full of values (mins/max) for various stances that I use a rand on for vertical/horizontal values.