示例#1
0
 public void RemoveShape(CCPhysicsShapeInfo shapeInf)
 {
     foreach (var shape in shapeInf.GetShapes())
     {
         if (_space.ContainsShape(shape))
         {
             _space.RemoveShape(shape);
         }
     }
 }
示例#2
0
        private void RemoveShapes()
        {
            lock (ShapesListLock)
            {
                foreach (var shape in _shapesToRemove)
                {
                    _space.RemoveShape(shape);
                    _space.RemoveBody(shape.body);
                }

                _shapesToRemove.Clear();
            }
        }
示例#3
0
        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);
        }