创建连接代码如下:这个代码不圆形刚体什么不动
private createRevoluteJoint(body, thing:IThing):void{
if (thing && thing.is_rotation && body) {
let center = body.GetWorldCenter();
var pointDef = new this.b2BodyDef;
pointDef.type = this.Box2D.b2BodyType.b2_staticBody;
pointDef.position.Set(center.x, center.y);
let point = this.world.CreateBody(pointDef);
let fixDef = new this.b2FixtureDef;
fixDef.density = 1000;
fixDef.friction = 0;
fixDef.restitution = 0;
let shape = new this.b2CircleShape;
shape.Set(new this.b2Vec2(0, 0), 2);
fixDef.shape = shape;
point.CreateFixture(fixDef);
let jointDef = new this.b2RevoluteJointDef;
jointDef.Initialize(point, body, center);
jointDef.collideConnected = true;
jointDef.enableMotor = true;
jointDef.motorSpeed = 1;
jointDef.maxMotorTorque = 100;
this.world.CreateJoint(jointDef);
body.SetAngularVelocity(thing.angle_speed * Math.PI / 180);
}
}
想创建一个圆形刚体在某个位置自己转动,用马达怎么做?自己不断的提供动力转动?
谢谢