开发者

box2D: move body to the point(touchesEnded)

I'm new to BOX2d and I need to move the body and the sp开发者_如何学JAVArite from the center to the point where there was contact with a low rate, I tried to use a projectile-> SetTransform (b2Vec2 (location.x / PTM_RATIO, location.y / PTM_RATIO), 0); but the movement is very fast and no noticeable


i dont know much about this but try ApplyForce or ApplyImpulse property


Try using a mouse joint. From the Box2d manual:

[A mouse joint] attempts to drive a point on a body towards the current position of the cursor. There is no restriction on rotation.

Searching for mouse joint will give you quite a few samples...

http://www.box2d.org/forum/viewtopic.php?f=8&t=402

http://iphonedev.net/2009/08/05/how-to-grab-a-sprite-with-cocos2d-and-box2d/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜