I was wondering if there is a way that i can access the rotation values of an object and script and display them as text on the screen of the game? I’m trying to get it so i have to “poles” that you have to rotate so that one of them is parallel to the other static one, once it is, it needs to display some text but I would like to have a live feed of its rotation relative to the other object as well, but i have no clue on how to do this, I’ve attached the code that i came up with for rotating the object below, just in case, its probably pretty ugly. I am very new to this (second week using unity) so I please if you have the answer as much information as you can would be much appreciated.
Thanks
(I’m not even sure if this is where I’m supposed to post this)
public class Inputs : MonoBehaviour
{
public float Speed;
public float RoateSpeed;
private Rigidbody rb;
private void FixedUpdate()
{
float moveX = Input.GetAxis("Horizontal");
float moveZ = Input.GetAxis("Vertical");
float moveY = Input.GetAxis("Jump");
float RotateY = Input.GetAxis("Rotate Y");
float RotateX = Input.GetAxis("Rotate X");
Vector3 movement = new Vector3(moveX, moveY, moveZ);
rb.AddForce(movement * Speed * Speed);
Vector3 lookhere = new Vector3(RotateY, 0, RotateX);
transform.Rotate(lookhere, RoateSpeed);
}
private void Start()
{
rb = GetComponent<Rigidbody>();
}
void Update ()
{
}
}