Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class CubeController : MonoBehaviour {
- public float target = 0.0f;
- public float speed = 45.0f;
- void OnMouseDown () {
- target -= 90;
- }
- void Update() {
- float angle = Mathf.MoveTowardsAngle(transform.eulerAngles.x, target, speed * Time.deltaTime);
- transform.eulerAngles = new Vector3(angle, 0, 0 );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement