What steps will reproduce the problem?
1. Make a static body with chain fixture box built with CreateChain starting at
top left and going clockwise (should require 5 verts)
2. Try changing the fixture to use CreateLoop with the same verts
3. Put a dynamic body on top of the body
What is the expected output? What do you see instead?
Objects fall into the inside of the chain shape / have unpredictable collision
with the object.
Please provide any additional information below.
This is happening because b2ChainShape::CreateLoop is trying to add the last
vertex itself, and in doing so is actually causing the same vertex to be
repeated twice which invalidates the b2_linearSlop assert which I am sure is
there for good reason.
My suggested fix would be to only add the new vertex if...
b2DistanceSquared(vertices[0], vertices[count-1]) > b2_linearSlop *
b2_linearSlop
...so that the same vert list would be compatible with both CreateLoop and
CreateChain without change. In the case where the first and last vertex are the
same, or very close, the function should operate the same as CreateChain while
also setting up prevVertex/nextVertex appropriately.
Original issue reported on code.google.com by scl...@freolic.com on 29 Oct 2014 at 6:50
Original issue reported on code.google.com by
scl...@freolic.com
on 29 Oct 2014 at 6:50