Unity Web Player. Install now!
Unity Web Player. Install now! Restart your browser after install.
//Code below runs each frame in a embedded JS engine inside the unity plugin.
//Most of the essential UntityEngine classes are exposed.
function SpawnSpheres()
{
    for(x = -5; x < 5; x++)
    {
        for(y = 0; y < 10; y++)
        {
            for(z = -5; z < 5; z++)
            {
                var go = GameObject.CreatePrimitive(0);
                go.transform.position = new Vector3(x + 0.1,y + 0.1,z + 0.1);
            }
        }
    }
}

function MoveCamera()
{
    var go = GameObject.Find("Main Camera");
    var pos = go.transform.position;
    var speed = 12;
    pos = new Vector3(
    pos.x + Input.GetAxis("Horizontal") * Time.deltaTime * speed,
    10,
    pos.z + Input.GetAxis("Vertical") * Time.deltaTime * speed);
    go.transform.position = pos;    
}

MoveCamera();
Debug.Log(Time.time);