How to create a "shake" effect when an object impacts the environment without affecting the player (because it's a flying vehicle).

Hi all.

I’m working on an On-Rails shooter game where the player controls a spaceship.

The environment includes closed sections with walls, effectively making the player fly inside a tunnel.

Now, one of the hazards that can be found in the tunnel is a “stomper”, which basically is a cylinder that moves and “stomps” on the ceiling, floor or side walls.

I want to make the environment shake a bit when the stomper stomps the environment. So far I’ve added a camera shake that I play when the stomper impacts the environment. However, this “moves” not only the environment, but the player’s spaceship as well, so it makes it look like the player has been hit, when the player is merely close to the impact point.

Is there a way to prevent the camera shake effect from affecting the player, as it’s flying and is not “pushed” by any vibrations propagated due to the impact?

I’ve not found a way to do this so far, and I’m open to suggestions about different ways to tackle this issue.

The player pawn follows a spline as the “forward” movement, while the player’s inputs control the “left/right/up/down” movement. I’m using a spring arm attached to the root component, while the camera is attached to the spring arm.

I understand that if you move the camera with the camera shake, everything in sight will be moved, including the player. So I’m wondering if there are any alternatives. If I don’t find a good solution I may resort to making some sort of animation on the enviroment where the stomper hits, but that may be costly.

Thanks in advance!