private void GetActiveBodiesOfType(BodyType type, ICollection <int> moving) { var bodyList = bodyLists[(int)type - 1]; var i = 0; while (i < bodyList.Count) { ref var body = ref bodies.WithId(bodyList[i]); // Store bodies out of this nodes bound for reinsertion and skip all duplicates. if (body.IsActive() && !moving.Contains(bodyList[i])) { moving.Add(bodyList[i]); } i++; }