Hello! So, I have some code that does almost exactly what I want it to do (see title), but it is rotating on the X axis, and I would like it to rotate on the Z axis. I thought this would be a simple fix, but I am stumped. Any help is much appreciated!
Here is the code:
using UnityEngine;
using System.Collections;
public class Rotator : MonoBehaviour
{
public float smooth = 1f;
private Quaternion targetRotation;
void Start ()
{
targetRotation = transform.rotation;
}
void Update ()
{
if (Input.GetKeyDown (KeyCode.Space)) {
targetRotation *= Quaternion.AngleAxis (90, Vector3.up);
}
transform.rotation = Quaternion.Lerp (transform.rotation, targetRotation, 10 * smooth * Time.deltaTime);
}
}