0
votes

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 really need help with this.

Thanks!

1
You can have a body with no shapes/fixtures, but it's not very useful because it has no way to interact with anything else in the world. You can make the fixtures 'sensors' so that they detect collisions but don't do any reaction.iforce2d

1 Answers

0
votes

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