Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

[Help] Rotating FPS Camera

A topic by shenanigans303 created Aug 22, 2024 Views: 112 Replies: 1
Viewing posts 1 to 2

Hey, I'm new to dev. If I rotate the player's gravity, how can I change the FPS camera appropriately? Effectively, how can I change what the camera thinks is "down"? Idk the proper terminology.

Discord: shenanigans303

It sounds like you are describing a transformation matrix. If you are using a specific engine or could share how you currently handle your FPS camera in code, I'm sure that someone might be able to be more helpful.

If I understand correctly, you want to build a "transformation matrix" from your "down" vector, which you will then apply to your camera's rotations. You might also need to look into "interpolation" to avoid sharp changes in your cameras rotations.
If you are actually using rotations to get your "down" vector, you might already have the matrix you need, since it's being applied to your "down" vector. Otherwise you might need to build the transformation matrix yourself.
 If you need to build your own transformation matrix, you might have to look up how to use "the cross product" of two vectors to create a transformation matrix.
If you are handling your player camera's pitch, yaw and roll rotations each frame, you would then multiply the camera's current rotation matrix with this transformation matrix, or the interpolated matrix (to avoid confusion if the gravity ever inverts itself too quickly).

I'm hoping someone else comes to help with your question, but if not; I hope some of the terms I've used can help point you in the right direction.