ryanwold.net

A civic-minded citizen seeking the singularity

An entry

Unity3d

Date: 2016-05-03
Status: release
Tags: unity3d 3d

I've been playing with Unity lately, and I've been loving it. Unity is designed as a video game platform that can be deployed to Macs and iOS products, Android, Windows, and more.

Unity consists of:

  • an Editor - a 3d environment with scriptable objects.where you can build a game/app/etc
  • an Engine - a deployable 3d environment for what you've built

Environment

In Unity, objects live in a hierarchy. The Hierarchy is a tab that lists objects in a project.

A few different type of objects exist: * Camera * Light * General Objects * Cubes * Spheres * Capsules * Your custom 3d shapes * Third-party 3d shapes

Programming

Unity is a nice development environment to work in. Very basically, it is easy to create Objects and create Scripts that give those objects Behavior.

Unity supports C# and Javascript. It also supports a language called Boo. I wanted to use Javascript because I was familiar with it, but I found out that Javascript support is limited in odd places currently, and figured a strongly-typed language (C#) wouldn't be a bad thing to learn and practice.

The API docs are here.

For each object above, Unity encourages writing Scripts and attaching the scripts to add behavior to the objects. Scripts make it possible to manipulate objects texture, position, rotation, size (these 3 attributes make a Transform). So, we can modify each object's transform with scripts.

Scripts

When attaching a script to an object in Unity, C# classes default with the following 2 methods.

Start () {}
Update () {}

Other available methods are:

FixedUpdate () {}

Testing

Animations

Lerping. "Lerp" stands for linear interpolation. I knew this concept at "Tween" from Macromedia Flash.