Android Unity3d 移动脚本
//model speed
var TranslateSpeed = 20;
//rotate speed
var RotateSpeed = 1000;
//draw gui
function OnGUI()
{
//gui background
GUI.backgroundColor = Color.red;
//model to left
if(GUI.Button(Rect(10,10,70,30), "left")){
transform.Rotate(Vector3.up *Time.deltaTime * -RotateSpeed);
}
if(GUI.Button(Rect(90,10,70,30), "font")){
transform.Translate(Vector3.forward * Time.deltaTime
*TranslateSpeed);
}
if(GUI.Button(Rect(170,10,70,30), "right")){
transform.Rotate(Vector3.up *Time.deltaTime * RotateSpeed);
}
if(GUI.Button(Rect(90,50,70,30), "back")){
transform.Translate(Vector3.forward * Time.deltaTime * -
TranslateSpeed);
}
if(GUI.Button(Rect(10,50,70,30), "left")){
transform.Translate(Vector3.right * Time.deltaTime *-
TranslateSpeed);
}
if(GUI.Button(Rect(170,50,70,30), "right")){
transform.Translate(Vector3.right * Time.deltaTime *
TranslateSpeed);
}
//info
GUI.Label(Rect(250, 10,200,30),"position" +transform.position);
GUI.Label(Rect(250, 50,200,30),"rotate position" +transform.rotation);
}
补充:移动开发 , Android ,