Hi I hope someone can help me here.
I was using a movement tutorial that was 4 years old
when I had error:
CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
using UnityEngine;
public class Movment : MonoBehaviour
{
public CharacterController controller;
public Transform cam;
public float speed = 6f;
public float turnsmoothtime = 0.1f;
float turnSmoothVelocity;
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; + cam.eulerAngles.y;
float Angle = Mathf.SmoothDampAngle(transform.eulerAngles.y, targetAngle, ref turnSmoothVelocity, turnsmoothtime);
transform.rotation = Quaternion.Euler(0f, Angle, 0f);
Vector3 moveDir = Quaternion.Euler(0f, targetAngle, 0f) * Vector3.forward;
controller.Move(moveDir.normalized * speed * Time.deltaTime);
}
}
}