Rotating a Camera around a player based on mouse movements

If you’ve every played the game Destiny 2 in a third person mode then you should get a general understanding of what I mean, if not then allow me to explain… When a user is moving the camera will follow then in a third person type fashion (this is not what I’m asking about) if a user stands still and moves there camera then it it’ll rotate the camera based on where the users mouse is going. Its similar to how the current camera system works, where when you hold down right-click when standing still it does this. You shouldn’t be able to scroll your mouse etc…

Meaning if I move my mouse up the camera should rotate on an arch upward (that way the camera is always the same distance from the user)

Basically like this but without needing to hold down right-click, and it only working while you aren’t moving.

I was thinking about cframing it based on the mouse actions but I don’t think this is a very reliable way to do it.

1 Like

I’m having trouble knowing what you’re asking, so you want a camera that does the same radial rotation as the camera without the need for holding right click only when stationary and remove the zoom in/out feature?
Specifically, what are you trying to do to change the camera?

You have everything correct.

However what do you mean by

This is exactly what you need.

14 Likes

While its nearly perfect the offset seems sort of strange while standing still and moving the camera it isn’t fit I’m entirely looking for.

You can change that with the “cameraPos” variable.

1 Like

Gotcha! While this is great and all the camera doesn’t follow the user properly if they make the camera look at themselves and then walk towards it. It should slingshot the camera to behind them again when they begin to move. How would you recommend I go about doing this?

Well, when the player starts to move you could lerp the camera behind them. But that would require a bit of math and a lot of code to make it feel good while playing. You don’t want the camera to be locked behind the player when they’re moving so you’d have to figure out a solution on when the camera should move behind the player and when the player should be able to control it freely.