Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. void OnTriggerStay(Collider col){
  2.        
  3.         if (col.tag == "Right Gate") {
  4.             Debug.Log ("Pasok");
  5.             float currentRotationY = this.gameObject.transform.localRotation.y;
  6.             float goalRotation = 90f;
  7.             Quaternion target = Quaternion.Euler (0, goalRotation, 0);
  8.             this.gameObject.transform.localRotation = Quaternion.Slerp (this.gameObject.transform.localRotation, target, Time.deltaTime * 3f);
  9.         } else if (col.tag == "Left Gate") {
  10.             Debug.Log ("Pasok");
  11.             float currentRotationY = this.gameObject.transform.localRotation.y;
  12.             float goalRotation = -90.0f;
  13.             Quaternion target = Quaternion.Euler (new Vector3(0, goalRotation, 0));
  14.             this.gameObject.transform.localRotation = Quaternion.Slerp(this.gameObject.transform.localRotation, target, Time.deltaTime * 2f);
  15.        
  16.            
  17.         }
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement