removeBreakableBody() 공개 메소드

public removeBreakableBody ( BreakableBody breakableBody ) : void
breakableBody BreakableBody
리턴 void
예제 #1
0
파일: BreakableBody.cs 프로젝트: tykak/Nez
        void decompose()
        {
            // Unsubsribe from the PostSolve delegate
            _world.contactManager.onPostSolve -= onPostSolve;

            for (int i = 0; i < parts.Count; i++)
            {
                var oldFixture = parts[i];

                var    shape    = oldFixture.shape.clone();
                object userData = oldFixture.userData;

                mainBody.destroyFixture(oldFixture);

                var body = BodyFactory.CreateBody(_world, mainBody.position, mainBody.rotation, BodyType.Dynamic, mainBody.userData);

                var newFixture = body.createFixture(shape);
                newFixture.userData = userData;
                parts[i]            = newFixture;

                body.angularVelocity = _angularVelocitiesCache[i];
                body.linearVelocity  = _velocitiesCache[i];
            }

            _world.removeBody(mainBody);
            _world.removeBreakableBody(this);
        }