how to reset free look camera

How can I reset the camera so that it’s back behind the player again after the user looks around with the mouse?

I’ve tried using

Camera.PreviousStateIsValid = false;
Camera.m_XAxis.Value = 0;
Camera.m_YAxis.Value = 0.5f;

but this only resets the zoom and not the position of the camera. How can I get the position to be back to behind the player it’s following?

Looking for it to happen instantly (not over time). Binding is Simple follow with world up.

Your problem is the binding mode. Simple Follow has no concept of “centered”, because it operates in Camera-space (which is always centered). Can you instead use LockToTargetWithWorldUp? Then you can turn on automatic recentering.

I want the user to be able to look around, just when they hit a button i want it to return to the default view (with camera behind player). When using LockToTargetWithWorldUp it seems to not allow them to switch from the default view.

What about World Space binding mode?
(you need to explain what the “default view” is)

World space is closer, but what I need is for when i say “Default view” it would be looking at the players back, centered in the screen again on the press of a button

In that case LockToTargetWithWorldUp auto-recenter should give you exactly what you want. The default position is to stay behind the character, and when the user moves the mouse you orbit around. Is that not what you want?

I’d like the user to be able to control when to recenter. I dont want it automatic.

Then don’t enable automatic recentering. When it’s time to recenter, set freeLook.m_XAxis.Value = 0 and freeLook.m_YAxis.Value = 0.5f (or whatever value corresponds to your desired default height).

1 Like

Got it working. Thanks!

1 Like