1 decade ago by andrecaribe
I'm doing some tests and ..
I drew, in Weltmeister, an ramp like a collision layer, but this ramp is converted to some rectangles, instead of something like a triangle.
This is bad because my car give some little jumps and create ramps in Weltmeister is long time and needs small tile size and great dimensions.
Example:
I drew, in Weltmeister, an ramp like a collision layer, but this ramp is converted to some rectangles, instead of something like a triangle.
This is bad because my car give some little jumps and create ramps in Weltmeister is long time and needs small tile size and great dimensions.
Example:

1 decade ago by andrecaribe
Ok, I got it. Triangle entity works fine.
I had some problems with the order of the vertices, if not in the correct order the object does not collide.
I had some problems with the order of the vertices, if not in the correct order the object does not collide.
createBody: function() { var shapeDef = new b2.PolygonDef(); shapeDef.vertexCount = 3; shapeDef.vertices[0].Set( 0.0 , 0.0 ); shapeDef.vertices[1].Set(-this.w * b2.SCALE, 0.0 ); shapeDef.vertices[2].Set( 0.0 , -this.h * b2.SCALE); shapeDef.density = 1.0; shapeDef.friction = 1; shapeDef.restitution = 0; shapeDef.filter.maskBits = 0xffff & ~0x0001; shapeDef.filter.categoryBits = 0x0001; this.bodyDef = new b2.BodyDef(); this.bodyDef.position.Set(this.pos.x * b2.SCALE, this.pos.y * b2.SCALE); this.body = ig.world.CreateBody(this.bodyDef); this.body.CreateShape(shapeDef); }
Page 1 of 1
« first
« previous
next ›
last »