Hi, first sorry for the bad english.
At first i have a script that makes my cube be rotated at one point, i would like you to help me to make it rotate slowly to the limit (90 degrees), and after that it stops rotating, without going beyond 90 the angle , it is extremely important for the project that it has an exact angle of 90 at the end of the movement, I know it seems little but I have been trying to do this for 6 hours without success.
I leave the script below
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Cube : MonoBehaviour
{
public Transform CubeTransform;
public Transform PFront;
void GetInput()
{
}
void Start()
{
}
void FixedUpdate()
{
if (Input.GetKey("w"))
{
CubeTransform.RotateAround(PFront.transform.position, Vector3.left, 90.0f);
}
}
void Update()
{
}
}
I did that, but it goes through the ground, I’ll explain better, I have a cube, and I would like to make it rotate on the ground around its ends, but instead everything I’ve done so far has made it have a different final rotation. of 0 , 90 , 180 , 270 , 360, which would be the shapes that it would fit perfectly into the floor