I’m trying to rotate a cloned object once it is spawned but i’m having difficulty and cant find any information about how to do this.
For example, i spawn a wall, once i press “R” it rotates to 90 degrees along its x axis. Or, if you press “R” it transforms to 90 and then you put it down? I just need an understanding on how to do this. I’m unfamiliar with Quaternions is this the problem?? The code i have doesn’t seem to be working.
if (Input.GetMouseButtonDown(0))
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
// Storage point for the Ray
RaycastHit hit;
if (Physics.Raycast(ray, out hit))
{
// Assigning the point its variable
endPoint = hit.point;
GameObject clone;
// Clone the objects and spawn them in the game 'world'
clone = Instantiate(items_, endPoint, items*.transform.rotation) as GameObject;*_
if (Input.GetKey(KeyCode.R))
{
clone.transform.Rotate(0, 90, 0);
Debug.Log(“Rotating Object”);
}
}
}