Hi there, I am probably re-opening this thread, but as there is some confusion this could help.
What is the best way, in term of performance, to have a curved surface ?
Thats what i did so far
Any other better way ?
What is the best way, in term of performance, to have a curved surface ?
Thats what i did so far
Code:
var p1:b2Vec2 = new b2Vec2(0 / PIXELS_TO_METRE, 100 / PIXELS_TO_METRE);
var p2:b2Vec2 = new b2Vec2(100 / PIXELS_TO_METRE, 200 / PIXELS_TO_METRE);
var p3:b2Vec2 = new b2Vec2(100 / PIXELS_TO_METRE, 250 / PIXELS_TO_METRE);
var p4:b2Vec2 = new b2Vec2(0 / PIXELS_TO_METRE, 250 / PIXELS_TO_METRE);
var arrV : Vector.<b2Vec2> = new Vector.<b2Vec2>();
arrV.push( p1 ) ;
arrV.push( p2 ) ;
arrV.push( p3 ) ;
arrV.push( p4 ) ;
var body : b2BodyDef = new b2BodyDef ;
body.position.Set(2 , 7 );
var poly : b2PolygonShape = new b2PolygonShape ;
poly.SetAsVector( arrV , 4 ) ;
var fixture : b2FixtureDef = new b2FixtureDef ;
fixture.shape= poly ;
var a : b2Body=m_world.CreateBody( body );
a.CreateFixture( fixture ) ;
var p2:b2Vec2 = new b2Vec2(100 / PIXELS_TO_METRE, 200 / PIXELS_TO_METRE);
var p3:b2Vec2 = new b2Vec2(100 / PIXELS_TO_METRE, 250 / PIXELS_TO_METRE);
var p4:b2Vec2 = new b2Vec2(0 / PIXELS_TO_METRE, 250 / PIXELS_TO_METRE);
var arrV : Vector.<b2Vec2> = new Vector.<b2Vec2>();
arrV.push( p1 ) ;
arrV.push( p2 ) ;
arrV.push( p3 ) ;
arrV.push( p4 ) ;
var body : b2BodyDef = new b2BodyDef ;
body.position.Set(2 , 7 );
var poly : b2PolygonShape = new b2PolygonShape ;
poly.SetAsVector( arrV , 4 ) ;
var fixture : b2FixtureDef = new b2FixtureDef ;
fixture.shape= poly ;
var a : b2Body=m_world.CreateBody( body );
a.CreateFixture( fixture ) ;
Any other better way ?