public void RemoveShape(CCPhysicsShapeInfo shapeInf) { foreach (var shape in shapeInf.GetShapes()) { if (_space.ContainsShape(shape)) { _space.RemoveShape(shape); } } }
private void RemoveShapes() { lock (ShapesListLock) { foreach (var shape in _shapesToRemove) { _space.RemoveShape(shape); _space.RemoveBody(shape.body); } _shapesToRemove.Clear(); } }
public void SliceShapePostStep(cpSpace space, cpShape shape, SliceContext context) { cpVect a = context.a; cpVect b = context.b; // Clipping plane normal and distance. cpVect n = cpVect.cpvnormalize(cpVect.cpvperp(cpVect.cpvsub(b, a))); float dist = cpVect.cpvdot(a, n); ClipPoly(space, shape, n, dist); ClipPoly(space, shape, cpVect.cpvneg(n), -dist); cpBody body = shape.GetBody(); space.RemoveShape(shape); space.RemoveBody(body); }