- Home /
FPS Mouselook Script Question
I have been developing a script for an fps game that looks like this:
function Update () {
var MouseScreenPosVector3 : Vector3 = GetComponent.<Camera>().ScreenToWorldPoint (Vector3 (Input.mousePosition.x, Input.mousePosition.y,10));
transform.LookAt(MouseScreenPosVector3);
}
However this script does not work, I have seen many people use it but the issue I have is that every frame it tries to look at the mouse it moves the whole screen, moving the location of the mouse that it needs to look at. How can I fix this?
This is going to be an issue of what the script is placed on.
transform.LookAt refers to the object the script is on.
Answer by fuego_see_money · Jun 30, 2015 at 11:05 AM
I would check here->
http://forum.unity3d.com/threads/looking-with-the-mouse.109250/
This is a very nice solution that lets you tailor your sensitivity in the inspector as well.
Thank you! I am working on a concept where the player has to wall run and the rotation of the player was wrecking many mouselook scripts that I tried.