Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

fps controller scripts

Hi i've used the fps controller scripts that work on a character controller but for some reason the camera wont move at the same time as the player and i cant see where the issue is coming from. the scripts look completely fine to me i don't think there is anything wrong there, would there be some other setting in unity that might be causing this ? here are the scripts i am using.

attached to the player object:

 public CharacterController charC;

  public float speed = 6;

  // Start is called before the first frame update

  void Start()


    charC = GetComponent<CharacterController>();


  // Update is called once per frame

  void Update()


    float x = Input.GetAxis("Horizontal");

    float z = Input.GetAxis("Vertical");

    Vector3 move = transform.forward * z + transform.right * x;

    charC.Move(move * speed * Time.deltaTime);


Attached to the camera which is set as a child of the player object:

 public float viewSpeed;

  public Transform player;

  private float xRotation;


  // Update is called once per frame

  void Update()


    float mouseX = Input.GetAxis("Mouse X") * viewSpeed * Time.deltaTime;

    float mouseY = Input.GetAxis("Mouse Y") * viewSpeed * Time.deltaTime;

    xRotation -= mouseY;

    transform.localRotation = Quaternion.Euler(xRotation, 0, 0);

    player.Rotate(Vector3.up * mouseX);


any help would be much appreciated as this has been driving me mad for about a week now


  • jtok4jjtok4j Member


    Could you have the camera be a child of the player object? Then no camera movement scripts would be required, if the player movement controls were working.

     Keep on Creating! 

    Justin of JustinTime Studios ( 

Sign In or Register to comment.