开发者

Creating a Body - Cocos2d/Box2d

I have a ball and another sprite. When the ball collides with the sprite it simulates falling.

My only problem is the other sprite is just on big image and the ball is on top of it, but there are spaces on the sprite and a lot of corners. I need to determine if the sprite has touch one of the corners. I know this is hard to understand.

So, my question is, is it possible to make a body without

b2PolygonShape blockShape;

and

blockShapeDef.shape = &blockShape;

OR

is there an alternative I can use? I cannot set the image as a box and it would take way to long to set edges because there are so many corners.

I have already set up the collision detection. I reall开发者_如何学编程y need help with this.

Thanks!


If you want it to react properly, you have to make a polygon using every single corner coordinate.

But don't be lazy about it. You can use SpriteHelper for creating *b2PolygonShape*s out of your sprites.

Or another alternative: VertexHelper

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜