using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class DontRotate : MonoBehaviour {
|
|
|
|
public Quaternion originalRot;
|
|
|
|
public float maxAngle;
|
|
|
|
public float turnSpeed = 0.5f;
|
|
|
|
// Use this for initialization
|
|
void Start () {
|
|
originalRot = transform.rotation;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update () {
|
|
transform.rotation = originalRot;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void lookAtDir(Vector3 inputDir) {
|
|
Quaternion targetRotation = Quaternion.LookRotation(inputDir, Vector3.up);
|
|
float str = Mathf.Min(turnSpeed * Time.deltaTime, 1);
|
|
transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, str);
|
|
}
|
|
}
|