I was following a tutorial for first person character controller from brackeys however I realised that every time I press the start button the camera would automatically look at the players feet instead of forward or where ever the camera was originally pointing at. So far I have no idea how to fix it.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class mousecontrol : MonoBehaviour
{
// Start is called before the first frame update
public float mousecontrolX;
public float mousecontrolY;
public float mousesensitivity = 100f;
public Transform player;
private float Rotation = 0f;
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
}
// Update is called once per frame
void Update()
{
mousecontrolX = Input.GetAxis("Mouse X") * mousesensitivity *Time.deltaTime;
mousecontrolY = Input.GetAxis("Mouse Y") * mousesensitivity * Time.deltaTime;
Rotation -= mousecontrolY;
Rotation = Mathf.Clamp(Rotation, -90f, 90f);
transform.localRotation = Quaternion.Euler(Rotation, 0f, 0f);
player.Rotate(Vector3.up * mousecontrolX);
}
}
Theres the code i use for my camera.