Ejemplo n.º 1
0
        public void RemoveBody(CCPhysicsBodyInfo bodyInf)
        {
            var body = bodyInf.GetBody();

            if (_space.ContainsBody(body))
            {
                _space.RemoveBody(body);
            }
        }
Ejemplo n.º 2
0
        private void RemoveShapes()
        {
            lock (ShapesListLock)
            {
                foreach (var shape in _shapesToRemove)
                {
                    _space.RemoveShape(shape);
                    _space.RemoveBody(shape.body);
                }

                _shapesToRemove.Clear();
            }
        }
Ejemplo n.º 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);
        }