Tuesday, June 2, 2009

back to basics

body.ApplyForce(new b2Vec2(20,0), body.GetWorldCenter())



body ---->


var bodyDef:b2BodyDef = new b2BodyDef();
//bodyDef.isBullet = true;/// penetrate object
var boxDef:b2PolygonDef = new b2PolygonDef();
boxDef.density = 1.0;
// Override the default friction.
boxDef.friction = 0.1;
boxDef.restitution = .4;
boxDef.SetAsBox(.5,.8);
bodyDef.position.Set(10,1);
bodyDef.angle = 45//Math.random() * Math.PI;
body = m_world.CreateBody(bodyDef);
shape1=body.CreateShape(boxDef);//collsion wer shape1:*
body.SetMassFromShapes();


/////////////////////////////////////////////////////////////////
Skin------>


wheel.x=body.GetPosition().x* 30;
wheel.y=body.GetPosition().y* 30
;
wheel.rotation = body.GetAngle() * (180/Math.PI);

m_sprite.addChild(wheel);
///////////////////////////////////////////////////////////////////////

No comments:

FEEDJIT Live