[videoembed type=”vimeo” ratio=”sixteen_by_nine” align=”aligncenter” width=”960″ url=”https://vimeo.com/60087467″ shadow=”yes” id=”video-2″]

***the scene runs at 60fps consistently in the engine but the video capture seems to drop frames despite running on a monster of a pc.

The above video is a quick test with some 2d assets dropped into a scene. I’m trying to get a feel for the space and the afforded movement within the space using the kinect. It gets the project moving along and gives me a better idea of what can actually be achieved or how difficult certain technical aspects will be. The basic premise of this scene is two colliders, one to make the trees grow and one to make them shrink. When the user moves away from the scene the trees shrink. Closer makes them grow. One thing thats apparent from testing this is that some form of marker and measurements will be required.

For testing i’m also using a first person camera. It gives a great effect moving through the scene but i’ll more likely be using some sort of avatar later. The first person camera has a lot of potential problems. The main problem is user registration. Its fine with one person but once another is detected it’ll create another camera and render from that but still take the position data from the first. This also creates multiple audio listeners as they are attached to the camera, causing a problem for any 3D sound that goes in the scene. I’m not really sure at this point how to limit user registration so the easiest thing to do is to simply cut out these potential problems and used a fixed camera. Maybe have the camera on some sort of transform follow script…hmm..

[divider_line /]

You’ll also notice the flock of primitives flying around. This is achieved using a Unity community script that create the objects and controls randomness, velocity and all that good stuff. Its pretty simple to use and modify while also allowing for a transform point to be set for the flock to fly to. The best thing about it is that it uses colliders so the flock actually bumps into objects in the scene and changes direction accordingly.
[button url=”http://wiki.unity3d.com/index.php?title=Flocking” color=”grey” width=”threequarter” ]Unity community – flocking script[/button]

[reveal width=”960″ align=”left” color=”grey” title=”Flocking Script – tap here for javascript!!” ]

var Controller : GameObject;

private var inited = false;
private var minVelocity : float;
private var maxVelocity : float;
private var randomness : float;
private var chasee : GameObject;

function Start () {

function boidSteering () {
while(true) {
if (inited) {
rigidbody.velocity = rigidbody.velocity + calc() * Time.deltaTime;

// enforce minimum and maximum speeds for the boids
var speed = rigidbody.velocity.magnitude;
if (speed > maxVelocity) {
rigidbody.velocity = rigidbody.velocity.normalized * maxVelocity;
} else if (speed < minVelocity) { rigidbody.velocity = rigidbody.velocity.normalized * minVelocity; } } waitTime = Random.Range(0.3, 0.5); yield WaitForSeconds(waitTime); } } function calc () { var randomize = Vector3((Random.value *2) -1, (Random.value * 2) -1, (Random.value * 2) -1); randomize.Normalize(); flockCenter = Controller.GetComponent("Boid Controller").flockCenter; flockVelocity = Controller.GetComponent("Boid Controller").flockVelocity; follow = chasee.transform.localPosition; flockCenter = flockCenter - transform.localPosition; flockVelocity = flockVelocity - rigidbody.velocity; follow = follow - transform.localPosition; return (flockCenter + flockVelocity + follow*2 + randomize*randomness); } function setController (theController : GameObject) { Controller = theController; minVelocity = Controller.GetComponent("Boid Controller").minVelocity; maxVelocity = Controller.GetComponent("Boid Controller").maxVelocity; randomness = Controller.GetComponent("Boid Controller").randomness; chasee = Controller.GetComponent("Boid Controller").chasee; inited = true; } [/reveal]