So I’ve been creating a combat system for my game and I thought I’d implement some kind of camera shake when you attack. And what I’ve noticed when looking at my inspiration for this idea: The Strongest Battlegrounds (The Strongest Battlegrounds - Roblox). Is that the camera does actually shake slightly in the direction your character is attacking, but the direction the camera shakes to is actually relative to what angle your camera is looking at your character.
As can be seen in the video, when you punch to the left while viewing your character from behind, the camera sways to the left slightly, but when viewing the front of the character (which is the opposite perspective) the punch can be viewed as going in the opposite direction, and the camera actually sways in the direction of the attack instead of left.
I think this is really cool, but when trying to think of how I’d implement this into my own game I couldn’t really figure it out. Firstly, I’m not an expert on camera manipulation so I couldn’t really figure out how you’d even create a camera shake effect. I’ve tried using the popular EZ camera shake module, but to my understanding you can’t really control the direction in which the camera is shaking.
And then of course there’s figuring out how to change the direction in which the camera is shaking relative to the angle that the character is being looked at. My best guess would be some form of raycasting to check if the camera’s position is in front or behind the player, and changing the direction of the camera shake depending on that. I’m sure there are other, simpler, ways of achieving this, but due to my lack of knowledge on camera manipulation I can’t really achieve anything similar to the effect I’m trying to achieve.