/// <summary> /// Remove a cube /// </summary> /// <param name="cube"></param> public void RemoveCube(Cube cube) { // denotify and remove from the denotify queue cube.DeNotify(); foreach (Skeleton skeleton in Skeletons) foreach (JointType jointType in JointsToTrack) if (DenotifyQueue.ContainsKey(skeleton.TrackingId) && DenotifyQueue[skeleton.TrackingId].ContainsKey(jointType)) if (DenotifyQueue[skeleton.TrackingId][jointType].Contains(cube)) DenotifyQueue[skeleton.TrackingId][jointType].Remove(cube); // kill from our view World.Cubes.Children.Remove(cube.ModelVisual3D); // remove from the cube list Cubes.Remove(cube); }