Unity 5 FPS-Controller: rotate Player

Hey guys

at the moment iam trying to implement the new FPS Controller from the Unity 5 Standard Assest

in my Game is a Collider that sets the player rotation to 0,270,0 so the player is looking automaticly in the right direction. the code for this is simple:

other.transform.rotation = tp.transform.rotation;

tp.transform.rotation is an object that has the rotation 0,270,0

But it doenst work with the new FPS Controller, probably because of the mouselook script.

has anyone an idea how to change my look direction with the new FPS Controller ?

I’ve been having the same problem. So far everything I’ve tried has no result. It seems like any changes you make just get overwritten by the mouselook script.

I’ve been getting the same problem, and yes its because the mouselook script it holding the current rotation for the controller and camera, and then only applies the mouse movement to it, therefore it doesnt know about any modification from the outside.

I currently dont have the time to write my own Controller, but that would be the best thing, so I came up with a quick fix:

Edit FirstPersonController.cs that comes with FPS Controller, and add the following function just below the Start() function

public void mouseReset() {
m_MouseLook.Init(transform, m_Camera.transform);
}

Then back in your code, once you have changed the rotation, immediately call this new function to reset the position to your new one. Something like this:

other.transform.rotation= tp.transform.rotation;
other.GetComponent().mouseReset();

HTHs

4 Likes

sorry to necro this post but… pulled my hair out for half an hour trying to figure this out. thanks!

Thank you so much, you made my day, I love man… :slight_smile:

1 Like