I have looked all over and found nothing that is working or I can take and use to move my player in the direction its facing. Can someone help me out?
{
[Header("Player Controll")]
public float MoveSpeed;
public float JumpForce;
public float Gravity;
private float VerticalVelocity;
private CharacterController Controll;
private Camera_Controll Cam;
void Start()
{
Controll = GetComponent<CharacterController>();
Cam = GetComponent<Camera_Controll>();
}
void Update()
{
if (Controll.isGrounded)
{
VerticalVelocity = -Gravity * Time.deltaTime;
if (Input.GetKeyDown("space"))
{
VerticalVelocity = JumpForce;
}
}
else
{
VerticalVelocity -= Gravity * Time.deltaTime;
}
float MoveDirFacing = Input.GetAxis("Mouse X");
if (Input.GetMouseButton(1))
{
transform.Rotate(new Vector3(0, MoveDirFacing * MoveSpeed * Time.deltaTime, 0));
}
Vector3 moveDir = new Vector3(0, VerticalVelocity, 0);
moveDir.x = Input.GetAxis("Horizontal") * MoveSpeed;
moveDir.y = VerticalVelocity;
moveDir.z = Input.GetAxis("Vertical") * MoveSpeed;
Controll.Move(moveDir * Time.deltaTime);
}
}