Hi everyone, first of all sorry for my english.
I'm very new in box2d and also not an expert in as3 and I really need your help. 😮 😕
So, today I've learned how to add box2d object on mouse click.
I used this great tutorial to make some objects and connect them with sprites
http://www.kerp.net/box2d/
so I also have actor class and so on...
this is my code:
first little problem is that it doesnt adds object in the place of mouse cursor, it keeps adding it about 30 pixels from my cursor (but it's probably because I didnt subtract position from my physicVal.ratio which is 30)
my real problem is that I dont know how to add mousejoint on that object immediately when it showes up (on the center of it), so I can release it or rotate it later.
any advice how to put it in that function?
thanks alot
I'm very new in box2d and also not an expert in as3 and I really need your help. 😮 😕
So, today I've learned how to add box2d object on mouse click.
I used this great tutorial to make some objects and connect them with sprites
http://www.kerp.net/box2d/
so I also have actor class and so on...
this is my code:
Code:
public function makeSomeBodies(e:MouseEvent):void
{
bodyActor = new BodyActor(this, new Point(e.target.mouseX, e.target.mouseY));
}
{
bodyActor = new BodyActor(this, new Point(e.target.mouseX, e.target.mouseY));
}
first little problem is that it doesnt adds object in the place of mouse cursor, it keeps adding it about 30 pixels from my cursor (but it's probably because I didnt subtract position from my physicVal.ratio which is 30)
my real problem is that I dont know how to add mousejoint on that object immediately when it showes up (on the center of it), so I can release it or rotate it later.
any advice how to put it in that function?
thanks alot