I am trying to rotate a turret on top of a tank and would like to use the “k” and “;” to spin the turret left and right. So far I’m not able to rotate at all.
Here is the code I’m using so far, please let me know where I am going wrong.
Thanks
using UnityEngine;
using System.Collections;
public class TurretRotationTest : MonoBehaviour {
private Transform turretTransform;
//public float rotationSpeed = 120.0f;
void Start () {
turretTransform = transform;
}
void Update () {
if(Input.GetKeyDown("m")) {turretTransform.localRotation *= Quaternion.AngleAxis( 10 * Time.deltaTime, Vector3.up );
}
}
}