Hello there.
So im not sure how to drag objects after the mouse on click.
Coudl you guys post me an exemple after my code so i better understand the method.
This is in box2d 2.02 version
Thank you.
So im not sure how to drag objects after the mouse on click.
Coudl you guys post me an exemple after my code so i better understand the method.
This is in box2d 2.02 version
Code: Select all
var metalShapeDef:b2PolygonDef=new b2PolygonDef();
metalShapeDef.vertexCount=3;
b2Vec2(metalShapeDef.vertices[0]).Set(0/Vals.RATIO, 0/Vals.RATIO);
b2Vec2(metalShapeDef.vertices[1]).Set(0/Vals.RATIO, -100/Vals.RATIO);
b2Vec2(metalShapeDef.vertices[2]).Set(100/Vals.RATIO, 0/Vals.RATIO);
metalShapeDef.density=1;
metalShapeDef.friction=0.9;
metalShapeDef.restitution=0.1;
var metalBodyDef:b2BodyDef=new b2BodyDef();
metalBodyDef.position.Set(location.x/Vals.RATIO, location.y/Vals.RATIO);
var metalBody:b2Body;
metalBody=Vals.world.CreateBody(metalBodyDef);
metalBody.CreateShape(metalShapeDef);
metalBody.SetMassFromShapes();
Thank you.