Advertisement
kasru

Rotate Character

Feb 28th, 2013
4,326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //****** Donations are greatly appreciated.  ******
  2. //****** You can donate directly to Jesse through paypal at  https://www.paypal.me/JEtzler   ******
  3.  
  4. var speed : int;
  5. var lerpSpeed : float;
  6. private var xDeg : float;
  7. private var YDeg : float;
  8. private var fromRotation : Quaternion;
  9. private var toRotation : Quaternion;
  10.  
  11. function Update () {
  12.  
  13.     if(Input.GetMouseButton(0)) {
  14.  
  15.             xDeg -= Input.GetAxis("Mouse X") * speed;
  16.             fromRotation = transform.rotation;
  17.             toRotation = Quaternion.Euler(yDeg,xDeg,0);
  18.         transform.rotation = Quaternion.Lerp(fromRotation,toRotation,Time.deltaTime * lerpSpeed);
  19.         }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement