Unity大杂烩

栏目: 后端 · 发布时间: 7年前

内容简介:以macOS为例:Unity必须登录后才能使用。需要先注册Unity帐号,登录后创建项目

以macOS为例: brew cask install unity

创建Unity项目

Unity必须登录后才能使用。需要先注册Unity帐号,登录后创建项目

Unity创建对象

  1. 在场景树上创建任意一种对象(比如立方体)
  2. 在文件树上创建一个材质,拖到这个对向上
  3. 在文件树上创建一个纹理(任意图片即可),拖到这个材质上
  4. 移动对象或摄像机,让对象出现在摄像机的视野里
  5. 在文件树上创建一个脚本,拖到这个对象上,绑定对象

让物体原地随机打转,并随机小幅位移

` csharp

`using UnityEngine;

public class NewBehaviourScript : MonoBehaviour

{

void Start()

{

}

void Update()
{
}

private void FixedUpdate()
{
    transform.position = transform.position + 0.05f * random();
    transform.forward = transform.forward + 0.1f * random();
}

Vector3 random()
{
    return new Vector3(
        Random.value - 0.5f,
        Random.value - 0.5f,
        Random.value - 0.5f
    );
}

}


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Algorithms + Data Structures = Programs

Algorithms + Data Structures = Programs

Niklaus Wirth / Prentice Hall / 1975-11-11 / GBP 84.95

It might seem completely dated with all its examples written in the now outmoded Pascal programming language (well, unless you are one of those Delphi zealot trying to resist to the Java/.NET dominanc......一起来看看 《Algorithms + Data Structures = Programs》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具