开发者

Rotating and throwing objects using flash and Box2D 2.1a

开发者 https://www.devze.com 2023-03-22 22:14 出处:网络
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 th

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.


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.


I think that this solution is applicable only when the background is not in perspective view. If I have a background like Paper Toss, ApplyForce

0

精彩评论

暂无评论...
验证码 换一张
取 消