public var rev1:b2RevoluteJoint;
var bodyDef2:b2BodyDef;
var boxDef2:b2PolygonDef;
bodyDef2 = new b2BodyDef();
bodyDef2.position.Set(26, 12.5);
//bodyDef2.angle = -.5;
boxDef2 = new b2PolygonDef();
boxDef2.SetAsBox(3, .1);//7
boxDef2.friction = .1;
boxDef2.density = 12.1;
/*
*/
body2 = m_world.CreateBody(bodyDef2);
body2.CreateShape(boxDef2);
body2.SetMassFromShapes();
/////////////// body 20
var bodyDef20:b2BodyDef;
var boxDef20:b2PolygonDef;
bodyDef20 = new b2BodyDef();
bodyDef20.position.Set(23, 12.5);
//bodyDef2.angle = -.5;
boxDef20 = new b2PolygonDef();
boxDef20.SetAsBox(.5, .1);//7
boxDef20.friction = .1;
boxDef20.density = 0;
/*
*/
body20 = m_world.CreateBody(bodyDef20);
body20.CreateShape(boxDef20);
body20.SetMassFromShapes();
///////////////////
var rjdDef:b2RevoluteJointDef = new b2RevoluteJointDef();
rjdDef.Initialize(body2, body20, body20.GetWorldCenter() );
rjdDef.enableLimit=true;
// rjdDef.maxMotorTorque=16600.0;
//rjdDef.motorSpeed=500.0;
rjdDef.enableMotor=true;
rjdDef.lowerAngle=-0.18*3.14
rjdDef. upperAngle=0.25*3.14
rev1 = m_world.CreateJoint(rjdDef) as b2RevoluteJoint;
/////// center is static and other is dynamic .. and you can play with dynamic///
somthing like this
body2.SetAngularVelocity(ang);
No comments:
Post a Comment