Advertisement
LittleAngel

Untitled

May 28th, 2013
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class CubeController : MonoBehaviour {
  5.  
  6.  
  7. public float target = 0.0f;
  8. public float speed = 45.0f;
  9.  
  10. void OnMouseDown () {
  11. target -= 90;
  12. }
  13.  
  14. void Update() {
  15. float angle = Mathf.MoveTowardsAngle(transform.eulerAngles.x, target, speed * Time.deltaTime);
  16. transform.eulerAngles = new Vector3(angle, 0, 0 );
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement