Hello Forum,
I get weird camera controls as you can see in the video:
I am messing around with building a FPS Style Character Controller. I have begun to build it from scratch. I have example assets I am working with. I have created a plane, later I will use terrain, for my character controller to walk on. I am using a Capsule 3D shape, the character controller component, and a camera. I have a script attached to the capsule and the camera.
They are as follows:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MoveCharCon : MonoBehaviour
{
public CharacterController controller;
void Update()
{
transform.Rotate(transform.up, -Input.GetAxis("Mouse X") * 7); ;
if (Input.GetKey(KeyCode.W))
controller.Move(transform.forward * Time.deltaTime * 5);
if (Input.GetKey(KeyCode.S))
controller.Move(-transform.forward * Time.deltaTime * 5);
if (Input.GetKey(KeyCode.A))
controller.Move(-transform.right * Time.deltaTime * 5);
if (Input.GetKey(KeyCode.D))
controller.Move(transform.right * Time.deltaTime * 5);
}
}
AND
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MoveCamera : MonoBehaviour
{
void Update()
{
transform.Rotate(transform.right, -Input.GetAxis("Mouse Y") * 3);
}
}