我需要获取夹具的主体,但是当我调用 fixture.GetBody() 函数时,它返回此错误: Object # has no method 'GetBody';
这是代码:
var bodyDef = 新 b2BodyDef;
var bouncebodyDef = new b2BodyDef;
bouncebodyDef.type = b2Body.b2_dynamicBody;
var bounceDef = new b2FixtureDef;
bounceDef.density = 1;
bounceDef.body = bouncebodyDef;
bounceDef.friction = 1;
bounceDef.restitution = 0;
bounceDef.userData = 'bounce';
bounceDef.shape = new b2PolygonShape;
bounceDef.shape.SetAsBox(1.5, 0.1);
bouncebodyDef.position.Set(2, 12);
bouncebodyDef.angle = (3.4);
world.CreateBody(bouncebodyDef).CreateFixture(bounceDef);
console.log(bounceDef.GetBody());
感谢您的任何建议。