Ballz.GameSession.Physics.PhysicsControl.RemoveRope C# (CSharp) Method

RemoveRope() public method

public RemoveRope ( Rope rope ) : void
rope Ballz.GameSession.World.Rope
return void
        public void RemoveRope(Rope rope)
        {
            foreach (var joint in rope.PhysicsSegmentJoints)
            {
                PhysicsWorld.RemoveJoint(joint);
            }

            rope.PhysicsSegmentJoints.Clear();

            foreach (var body in rope.PhysicsSegments)
            {
                RopesByPhysicsBody.Remove(body);
                RemoveBody(body);
            }

            rope.PhysicsSegments.Clear();
            if (rope.AttachedEntity is Ball)
            {
                (rope.AttachedEntity as Ball).PhysicsBody.Mass = 10f;
                (rope.AttachedEntity as Ball).PhysicsBody.FixedRotation = true;
            }
        }