Here’s the script i’m using
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(Rigidbody))]
public class RotateCharacter : MonoBehaviour
{
public float rotationSpeed = 180f; // Adjust this value for rotation speed
private Rigidbody rb;
private void Start()
{
rb = GetComponent();
}
private void Update()
{
float rotateInput = Input.GetAxis(“Rotate”);
// Rotation
Vector3 rotation = new Vector3(0f, rotateInput * rotationSpeed * Time.deltaTime, 0f);
Quaternion deltaRotation = Quaternion.Euler(rotation);
rb.MoveRotation(rb.rotation * deltaRotation);
}
}
I still can’t understand why it won’t work