- Home /
Question by
oB77 Raptr · May 31, 2015 at 08:09 AM ·
camerajavascriptmovementplayer
Making my look script turn smoothly
I need help with my player look controls script. i have got the movement right but it doesn't feel smooth. also how do i make it so my player when he looks up the camera stops flipping so that he can only look straight up or straight down.
here's my code
#pragma strict
var lookSensitivity : float = 100;
var player : GameObject;
function FixedUpdate() {
var upDownLook = Input.GetAxis("Mouse Y") * lookSensitivity;
var leftRightLook = Input.GetAxis("Mouse X") * lookSensitivity;
upDownLook *= Time.deltaTime;
leftRightLook *= Time.deltaTime;
transform.Rotate(-upDownLook,0,0);
player.transform.Rotate(0,leftRightLook,0);
}
any helps appreciated.
Comment