I was working on a Brackeys tutorial, the “THIRD PERSON MOVEMENT in Unity”, and at this point in the video, he tests it and it works. my code is exactly the same as far as i see and the speed variable isnt 0, but my character doesnt move. heres my script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class movement : MonoBehaviour
{
public CharacterController controller;
public float speed = 6f;
// Update is called once per frame
void Update()
{
float horizontal = Input.GetAxisRaw("Horizontal");
float vertical = Input.GetAxisRaw("Vertical");
Vector3 direction = new Vector3(horizontal, 0f, vertical).normalized;
if(direction.magnitude >= 0.1f)
{
float targetAngle = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg;
transform.rotation = Quaternion.Euler(0f, targetAngle, 0f);
controller.Move(direction * speed * Time.deltaTime);
}
}
}
.
Is there anything i can do?