我们今天学习了transform和Input
1.坐标系
概念理解“世界坐标系”“局部坐标系”世界坐标系(word)与本地坐标系(local);所有物体的世界坐标系都是相同的,不会改变,每个物体都有一个本地坐标系,当物体旋转时,本地坐标系统也会跟着物体一起旋转。
例如:把Cube的Rotation改为(60,0,0),这样世界(word)坐标和本地(loca/self)坐标就不一样了。
2.常用的必然事件
Unity的脚本中,可以定义一些特定的函数,这些函数会在满足某些条件时由Unity自动调用,它们被称为必然事件(Certain Events)。而Start和Update正是最常用的两个事件,因此Unity默认为新建的脚本添加了这两个事件。
3.输出
print("hello");//普通输出
Debug.Log("hello");//测试打印
Debug.LogWarning("hello");//警告打印
Debug.LogError("hello");//错误
声明:此篇文档时来自于【狗刨学习网】社区-unity极致学院,是网友自行发布的Unity3D学习文章,如果有什么内容侵犯了你的相关权益,请与官方沟通,我们会即时处理。
4.监视变量
public int id;//在监视面板里面可以看到
private string name;//在监视面板里面看不到
protected string sex;//在监视面板里面看不到
int age;//在监视面板里面看不到
5.Transfrom
transform.Translate (Vector3.forward);//向前走
transform.Translate (new Vector3(10,0,0));//向左右走
transform.Rotate (new Vector3(0,10,0));//向上下走
transform.localScale += new Vector3 (0.1F, 0, 0);//向前后走
public Transform Mycylinder; //定义变量
transform.RotateAround( Mycylinder.transform.position ,Vector3 .up ,9f);//旋转