Welcome to Unity Learning, unity training, Unity Enterprise training and education zone, there are many u3d resources, u3d training videos, u3d tutorials, U3d Frequently asked questions, U3d Project source code, we are committed to creating the industry Unity3d training, learning the first brand.
Last we talked about how to make unity come with a terrain system, then this is a quick way to explain how to use scripting to control.
First, select Gameobject->create other->cube to create a cube.
We save this scenario as TankWar0.2 for version control.
Adjust the position of the cube and the camera so that you can see the camera on the screen roughly.
650) this.width=650; "id=" aimg_4328 "class=" Zoom "src=" http://unity.gopedu.com/data/attachment/forum/201410/18/ 151611aqynatlg9bvcycds.jpg "width=" "style=" border:0px;/>
Drag the Cubemove in the project panel onto the cube to assign it to a block, click Run and try to find that as we press the WASD on the keyboard, the block will change accordingly.
Next we add a script to the camera to control it, but this script is written by unity in advance.
Right-clicking on the project panel, as described in the previous article, we introduced a scripts folder with a Smoothfollow script file that was dragged and dropped onto the Maincamera.
Check Maincamera again to see that there is already a script file attached to it.
Hold the cube on the Hierachy panel and drag it to the target on the script:
650) this.width=650; "id=" aimg_4329 "class=" Zoom "src=" http://unity.gopedu.com/data/attachment/forum/201410/18/ 151735bpe5003t0l8ir4e8.jpg "width=" "style=" border:0px;/>
This enables the script to be associated with a block.
Run the file at this time and we'll find that the camera can move along with the block.
This time again to repeat the above mentioned adding a rigid body, run again, then this small block with a rigid body even if the configuration is complete.
For more highlights, please click http://www.gopedu.com/
Unity3d the use and description of the program script for moving objects