I have a first person controller .I want to move this man left and right ,when i press the left arrow and right arrow. For this i attach a script calle playermove. its working fine but isuue is that when i turn the playe it translate/move little bit. why ?Please help?
using UnityEngine;
using System.Collections;
public class PlayerMove : MonoBehaviour {
public float moveSpeed=5f;
public Transform camera;
public float posY;
public float turnSpeed=50f;
void Update(){
if(Input.GetKey(KeyCode.LeftArrow))
transform.Rotate (Vector3.up,-turnSpeed*Time.deltaTime);
if(Input.GetKey(KeyCode.RightArrow))
transform.Rotate (Vector3.up,turnSpeed*Time.deltaTime);
}
}
↧