Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

After cocos2d, I'm looking at box2d... And I have some questions:

I was wondering how to cut a body into pieces.

  1. How do I determine the intersection point of the body with the cut line?

  2. Create a new body in some "update_body_method"?

On the second question I have answer, for example between two points create vector from first point to second point.

share|improve this question
up vote 2 down vote accepted

There is an implementation of this in the Farseer engine (C#) which is based on Box2D:

..\Source Files\Common\Polygon Manipulation\CuttingTools.cs

// This is a high-level function to cuts fixtures inside the given world, using the start and end points.
public static void Cut(World world, Vector2 start, Vector2 end, float thickness)

// Split a fixture into 2 vertice collections using the given entry and exit-point.
public static void SplitShape(Fixture fixture, Vector2 entryPoint, Vector2 exitPoint, float splitSize, out Vertices first, out Vertices second)
share|improve this answer
Thanks, I will try... – Darth Vader Jul 26 '11 at 12:23
For simple example I create one body and vector, vector construct on two points. Collision between vector and body works fine, but I still did not think how to get the intersection point of the vector and the body??? UPD: I have one idea, but... – Darth Vader Jul 26 '11 at 13:04
I believe you can use this method to get the intersection points : b2Shape.RayCast(...)… – Den Jul 26 '11 at 14:04
I found this method in documentation. – Darth Vader Jul 26 '11 at 14:32
From documentation:**You can cast a ray at a shape to get the point of first intersection and normal vector** It is only one point, but I need two points. May I use in this case Contact Manifolds??? – Darth Vader Jul 27 '11 at 8:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.