Nilesh Mahajan
Nilesh Mahajan

Reputation: 617

How to make crater like destruction in Box2d body

Can you please help me to do crater like effect in Box2d body, currently i am developing game with Cocos2d-x using box2d, please give me some suggestion for this

Upvotes: 0

Views: 137

Answers (1)

Pavel
Pavel

Reputation: 2554

enter image description here

Note:

  • new fixtures must be convex
  • new fixtures has limited count of points (by default, up to 8). As you can see in the picture, in new fixtures there are +1 points comparing to source fixture.
  • in old box2d versions, you should sure right winding of the points
  • it is not trivial task, to find bottom midle point. For example, I used triangulation for this purposes.
  • crater point can be projection of the contact point to nearest edge. Contact point itself can be somewhere near to edge.
  • there is special case, when crater point is near to corner.

Upvotes: 1

Related Questions