This project has moved and is read-only. For the latest updates, please go here.

CuttingTools.Cut Origin Issue

Topics: Developer Forum, User Forum
Aug 9, 2011 at 6:37 AM
Edited Aug 9, 2011 at 7:05 AM

Hello all,

I've been working through learning some of the tools and I'm quite impressed with the work done here. Everything was going smoothly until I attempted to use the cut. I can successfully cut a body and remove it. However when it comes to drawing the split body I have an issue

This is before the cut

The red line is about where the cut occurs. I then tap into the resulting fixture added / removed delegates and grab the results taking the fixtures body and adding it to my draw methods. However this is the result.


I've turned gravity off, but when I had it on the shapes moved properly. The just drew off. Like the smaller piece falls to the left and the larger piece falls off to the right. It's just the drawing that appears off. However for the life of me I can't solve why my draw method is wrong.

Could some kind soul point my in the right direction in solving this problem?

Edit: More info: The local centers of the initial 3 bodies are all 0,0. However the two new ones share the same local center. and it's not 0,0 which leads me to believe that may be the cause of my problem, however zeroing the local center does nothing.

Edit: Even more thoughts: What appears to be the issue is that the position at Body.Position is not the same as whatever is happening on screen. it draws at the bodies position but the logic appears wrong in that both things get the old bodies position not their respective new positions. so now why is there a difference in the Body.Position and whatever is being used to solve?

Aug 11, 2011 at 7:29 AM

It's working better, maybe I don't get the engine but in the cutting tool it doesn't properly align the new shapes. I adjust the vertices by the new shapes centroid and then set the new position to be the old bodies position plus the centroid. I get the feeling however that this may still be wrong as diagonal cuts are causing issues. When I get it fully solved I will post my changes