2015/07/06////////
by xbw//////////////
Environmental unity4.6.1//
Share some Unity character control code;;
Using unityengine;using System.collections;public class playcontrol:monobehaviour{public float Movespeed =10f;< C1/>void Update () { if (Input.getkey (keycode.uparrow)) transform. Translate (Vector3.forward * movespeed*time.deltatime); if (Input.getkey (keycode.downarrow)) transform. Translate (Vector3.back * movespeed * time.deltatime); if (Input.getkey (keycode.leftarrow)) transform. Translate (Vector3.left * movespeed * time.deltatime); if (Input.getkey (keycode.rightarrow)) transform. Translate (vector3.right * movespeed * time.deltatime); if (Input.getkey (keycode.space)) transform. Translate (vector3.up * movespeed * time.deltatime); }}
This is the CSharp direction key plus the space jump control character code;;;
Test object is a cube, no collision is OK, add a collision, the physical effects of the cube direction is broken,
Can't control the object very well, it's a problem, and it's going to be solved later,
Add Unity code Smoothfollow.js to the main camera, you can see good game effect,
As for how to add, see my other articles, the realization of the scene cycle of the article ....
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Unity3d Role Code Control issues