유니티3D/예제

UpDownRotate

당꿈응 2013. 9. 3. 16:29


using UnityEngine;

using System.Collections;


public class UpDownRotate : MonoBehaviour {

public float rotateSpeed = 60.0f;


// Update is called once per frame

void Update () {

float v = Input.GetAxis("Vertical");

float currentAngle = transform.eulerAngles.z;

currentAngle += v *rotateSpeed * Time.deltaTime;

currentAngle = Mathf.Clamp(currentAngle,0f,90f);   //limit value

transform.rotation = Quaternion.Euler(Vector3.forward * currentAngle);

}

}