I have a tank in my game and I’m trying to figure out how to rotate the turret back to the position it started after there are no enemies in sight.
public Quaternion TurretRest;
public void Start()
{
TurretRest = this.gameObject.transform.FindChild ("Turret").transform.localRotation;
//Should be (0,0,0) when looking at the localrotation
}
Quaternion Rot3 = Quaternion.LookRotation(TurretRest);
//Cannot use a quaternion (TurretRest) after the look rotation so what would I put there instead?
Turret.transform.rotation = Quaternion.Slerp (Turret.transform.rotation, Rot3, Time.deltaTime);