Search code examples
flashbox2dthrow

Rotating and throwing objects using flash and Box2D 2.1a


i'm using flash with box2D 2.1a. i'm rotating ball hanging on the string. The path which the rotating ball trace is ellipse. When releasing the rotating ball from the string i want the ball to fly with the obtained direction, velocity and strength. As you can see in the pictures.

http://imageshack.us/photo/my-images/841/circle1.jpg/

http://imageshack.us/photo/my-images/688/circlethrow.jpg/

I've tried to do it with setPosition (method of b2Body) and with various joints. But I haven't got the needed results.


Solution

  • If I understand what you mean by "fly", you want to apply a force:

    _b2Body.ApplyForce(new b2Vec2(500, 0), _b2Body.GetPosition());
    

    Hope that helps.