您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 质量控制/管理 > UNITY3D-C#脚本-实现点击物体旋转
Unity3dC#脚本实现点击物体旋转usingUnityEngine;usingSystem.Collections;publicclassroated:MonoBehaviour{privateboolroate;privatefloatRoatedSpeed=1000.0F;voidStart(){roate=false;}//UpdateiscalledonceperframevoidUpdate(){if(Input.GetMouseButton(0)){floaty=0;y=Input.GetAxis(MouseX)*RoatedSpeed*Time.deltaTime;if(roate){gameObject.transform.Rotate(newVector3(0,y,0));}}}voidOnMouseDown(){roate=true;Debug.Log(collider);}voidOnMouseUp(){roate=false;Debug.Log(Outofcollider);}}
本文标题:UNITY3D-C#脚本-实现点击物体旋转
链接地址:https://www.777doc.com/doc-3960145 .html