Getting started with Unity: Day01

Table of contents

(1) Main Panel Learning

(2) Code control movement


(1) Main Panel Learning

Scene panel : Similar to the filming set, Unity programmers can control or edit the actors on the set.

Game panel : Similar to the director's monitor, it is the screen that the player sees when installing the game. Select the camera and press Ctrl+Shift+F to quickly switch the viewing angle in the Game to the viewing angle in the Scene.

Hierarchy panel : It is equivalent to the roster of the set, recording all the objects in the current scene. It is generally regarded as a cache and loaded into memory.

Inspector panel : hosts all components of the currently selected game object, and the game object is composed of components.

Project panel : project management panel, all the resources used by the game are stored in it, stored in the hard disk

Console panel : The console panel has a series of output information.

: Several ways to manipulate objects

:center means to display the geometric center point of the parent and child objects.

: pivot means to display the geometric center point of the currently selected object.

 : local means to display the current object's own coordinate system, and the rotating object will change accordingly.

 :global means to display the current world coordinate system, and the rotating object will not change.

: Debug, pause, and next frame in sequence (there may be games that require frame-by-frame debugging).

: Cloud service, used to manage versions.

 1. Game objects are containers for game components, and game components cannot exist independently; Transform is the most basic component of game objects. Unity programming is programming for game components.

2. Prefab, it is blue in the Hierarchy panel; there are three buttons in the Inspector, select: select the body of the current prefab; revert: cancel the operation on the current prefab; apply: apply the current modification to the prefab.

3. Import and export game resource package: Right-click the selected resource in the Project, click Export, and the package can be exported, which will include all the resources referenced by the object.

(2) Code control movement

(1) Rotation: Transform.Rotate(); divided into rotation according to its own coordinate system and rotation according to the world coordinate system.

 Common overloads:

/*
第一种:public void Rotate(Vector3 eulers);
*/

transform.Rotate(new Vector3(10,0,0));//表示绕自身X轴旋转,旋转速度为10度。
transform.Rotate(new Vector3(10,0,0),Space.Self);//和上面一行的代码等价,因为默认就是按照自身坐标轴旋转
transform.Rotate(new Vector3(10,0,0),Space.World);//按照世界坐标轴X轴旋转
/*第二种:public void Rotate(Vector3 axis, float angle);*/

transform.Rotate(new Vector3(0,1,0),10);//表示绕着自身y轴旋转,速度为10度。

Please note: These two ways of rotation, transform.Rotate(new Vector3(1,2,3)); and transform.Rotate(new Vector3(1,2,3),1); The rotation speed of the two is different, the former The three directions have different speeds, and the latter three directions have uniform speeds. Because it rotates around its own coordinate axis, the rotation axis may not be fixed, and the rotation looks unstable.

/*第三种:public void RotateAround(Vector3 point, Vector3 axis, float angle);*/
public GameObject target;
transform.RotateAround(target.transform.position,Vector3.up,10);//表示以目标作为原点,绕着原点的y方向进行速度为10的旋转。


The learning version is Unity2017

Guess you like

Origin blog.csdn.net/m0_70379630/article/details/125546927