MY CODE :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playermovescript : MonoBehaviour
{
public CharacterController newcontroller;
public float speed = 6f;
public float gravity = -6f;
public float turnSmoothTime = 0.4f;
float turnsmoothvolocity;
Vector3 velocity;
public Transform groundCheck;
public float groundDistance = 0.8f;
public LayerMask groundMask;
bool IsGrounded;
// Update is called once per frame
void Update()
{
IsGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);
if (IsGrounded && velocity.y < 0)
{
velocity.y = -0.5f;
}
velocity.y += gravity * Time.deltaTime;
newcontroller.Move(velocity);
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.Aten2(direction.x, direction.z) * Mathf.Rad2Deg;
float angle = Mathf.SmoothDampAngle(transform.eulerAngles.y, targetAngle, ref turnsmoothvolocity, turnSmoothTime);
transform.rotation = Quaternion.Euler(0f, angle, 0f);
newcontroller.Move(direction * speed * Time.deltaTime);
}
}
}
i do not know whats causing this error?