Answer the question
In order to leave comments, you need to log in
Why doesn't smooth turn work?
I want to smoothly open the door, but for some reason the code does not work
using UnityEngine;
public class Door : MonoBehaviour
{
[SerializeField] private int _angle;
[SerializeField] private Transform _root;
[SerializeField] private State _state;
enum State
{
Standart,
Open,
}
private void OnMouseDown()
{
if(_state == State.Standart)
{
_root.eulerAngles = Vector3.Lerp(transform.eulerAngles, transform.eulerAngles + Vector3.up * _angle, 1000);
_state = State.Open;
}
else
{
_root.eulerAngles = Vector3.Lerp(transform.eulerAngles, transform.eulerAngles - Vector3.up * _angle, 1000);
_state = State.Standart;
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question