Tuio Kinect with Rippler

Tuio是一個十分好的一個工具,有很多方法可以與它溝通,之前試用以iOS, Android 方式輸入gesture,今次便玩玩Kinect吧!

Estee Lauder - Cyber White 2011

我對這 Project 可說是又愛又恨...

Load DAE Object in Flash


Box 2D - Falling Box



import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;

var hk-marketing-campaign:Timer=new Timer(500);
var b2world:b2World;
init();

function init()
{
// create b2AABB
var environment:b2AABB = new b2AABB();
environment.lowerBound.Set(-100.0,-100.0);
environment.upperBound.Set(100.0,100.0);

// create b2Vec2
var gravity:b2Vec2=new b2Vec2(0.0,50.0);

var canISleep:Boolean=false;

// create b2World
b2world=new b2World(environment,gravity,canISleep);

// create b2DebugDraw

var debugDraw:b2DebugDraw = new b2DebugDraw();
var debug_sprite:Sprite = new Sprite();
addChild(debug_sprite);
with (debugDraw)
{
m_sprite=debug_sprite;
m_drawScale=30;
m_fillAlpha=0.5;
m_lineThickness=1;
m_drawFlags=b2DebugDraw.e_shapeBit;
}
b2world.SetDebugDraw(debugDraw);

// create b2BodyDef
var bodyDef:b2BodyDef;
bodyDef=new b2BodyDef();
bodyDef.position.Set(14,14);

//create b2PolygonDef
var box:b2PolygonDef;
box=new b2PolygonDef();
with (box)
{
SetAsBox(500/60,20/60);
friction=0.3;
density=0;
}

// create b2Body
var body:b2Body;
body=b2world.CreateBody(bodyDef);
body.CreateShape(box);
body.SetMassFromShapes();

addEventListener(Event.ENTER_FRAME,enterFrameHandler);
hk-marketing-campaign.addEventListener(TimerEvent.TIMER, timeHandler);
hk-marketing-campaign.start();
}

function timeHandler(e:Event)
{
// create b2BodyDef
var bodyDef:b2BodyDef;
bodyDef=new b2BodyDef();
bodyDef.position.Set(Math.random()*10+7,-1);

// create b2PolygonDef
var box:b2PolygonDef;
box=new b2PolygonDef();
with (box)
{
var num:Number=Math.random()*1+0.3;
SetAsBox(num,num);
friction=0.3;
density=1;
}

// create b2Body
var body:b2Body;
body=b2world.CreateBody(bodyDef);
body.CreateShape(box);
body.SetMassFromShapes();
}

function enterFrameHandler(e:Event)
{
b2world.Step(1/30,10);
}

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More