阅读背景:

Unity3D实现点击物体旋转

来源:互联网 
using UnityEngine;
using System.Collections;

public class roated : MonoBehaviour {
	private bool roate;
	private float RoatedSpeed = 1000.0F;
	void Start () {
		roate = false;
	}
	
	// Update is called once per frame
	void Update () {
	
		if(Input.GetMouseButton(0))
		{
			float y = 0;
			
			y = Input.GetAxis("Mouse X")*RoatedSpeed*Time.deltaTime;
			if(roate)
			{
				gameObject.transform.Rotate(new Vector3(0,y,0));
				
			}
			
		}
		
	}
	void OnMouseDown()
	{
		
		roate =true;
		Debug.Log("collider");
	}
	void OnMouseUp()
	{
		roate = false;
		Debug.Log("Out of collider");
	}
	
}using UnityEngine;
using System.Collections;

p



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: