脚本如下: var controller : CharacterController = GetComponent(CharacterController);
if(GUI.RepeatButton(Rect(65,Screen.height-130,40,40),"W"))
{controller.SimpleMove(controller.transform.TransformDirection(Vector3.forward)*3); }
if(GUI.RepeatButton(Rect(25,Screen.height-90,40,40),"A"))
{ controller.transform.Rotate(0,Mathf.Lerp(0,-1,1),0);
// controller.SimpleMove(controller.transform.TransformDirection(controller.transform.Vector3.forward)*3);
// controller.SimpleMove(controller.transform.TransformDirection(Vector3.forward)*-3);
print(Mathf.Lerp(0,-1,1).ToString());
}
if(GUI.RepeatButton(Rect(105,Screen.height-90,40,40),"D"))
{ controller.transform.Rotate(0,1,0); }
if(GUI.RepeatButton(Rect(65,Screen.height-50,40,40),"S"))
{ controller.SimpleMove(controller.transform.TransformDirection(Vector3.forward)*10);
controller.transform.Rotate(0, Mathf.Lerp(0, 270, 0.01),0);
//carmera_.transform.Rotate(0, Mathf.Lerp(0, 270, 0.01),0); }
|