1 decade ago by Oliver
Im really new using box2d and i know its a dumb question, but i really cant get my entitys to be circular! i know im missing only 1 line, but i cant get witch one.
mixing code i found on posts here and there i did the "player.js" init funcition look like this:
it obviously doesnt get blFixDef and bodyDef porperties because i am missing that line. Could someone share his awesomeness with me? Im getting really mad with this :(
mixing code i found on posts here and there i did the "player.js" init funcition look like this:
init: function( x, y, settings ) {
this.parent( x, y, settings );
//this.addAnim( 'idle', 1, [0] );
var b2CircleShape = Box2D.Collision.Shapes.b2CircleShape;
var blFixDef = new Box2D.Dynamics.b2FixtureDef();
blFixDef.shape = new b2CircleShape();
var hw = 5 * 0.5; // "half width"
var hh = 5 * 0.5; // "half height"
blFixDef.shape.SetRadius(hw);
var newX = (this.pos.x + this.size.x) * Box2D.SCALE ;
var newY = (this.pos.y + this.size.x) * Box2D.SCALE ;
var bodyDef = new Box2D.Dynamics.b2BodyDef();
bodyDef.position.Set(newX, newY);
//ig.world.CreateBody(bodyDef).CreateFixture(blFixDef);
//this.body.DestroyFixture(this.body);
//ig.world.DestroyBody( this.body );
//this.body.CreateFixture(blFixDef);
console.log(this.body.GetFixtureList());
//this.body.SetMassData(blFixDef);
//this.body.shape = bodyDef;
},
it obviously doesnt get blFixDef and bodyDef porperties because i am missing that line. Could someone share his awesomeness with me? Im getting really mad with this :(
