public void Update(ClientPhysicsQuadTreeNode root, IXNAGame game)
        {
            if (sleeping && actor.IsSleeping)
            {
                return;
            }
            if (sleeping && !actor.IsSleeping)
            {
                // Make dynamic again!
                sleeping = false;
                Node.AddDynamicObjectToIntersectingNodes(this);
            }

            if (actor.IsSleeping && !sleeping)
            {
                // Disable dynamic, thus make static
                if (node != null)
                {
                    node.RemoveDynamicObjectFromIntersectingNodes(this);
                }

                sleeping = true;
                if (node != null && node.PhysicsEnabled == false)
                {
                    DisablePhysics(); // disable movement
                }
                return;
            }


            Move(root, actor.GlobalPosition);
        }
        public void Move(ClientPhysicsQuadTreeNode root, Vector3 newCenter)
        {
            // NOTE: IMPORTANT: this is actually a partial implementation of the algorithm itself

            Vector3 oldCenter = Center;
            ClientPhysicsQuadTreeNode oldNode = Node;


            // Update location in quadtree
            Center = newCenter;
            root.OrdenObject(this);

            // Update dynamic object count

            Node.AddDynamicObjectToIntersectingNodes(this);   // Add must come before remove to prevent overhead

            if (oldNode != null)
            {
                Center = oldCenter; // set old state
                oldNode.RemoveDynamicObjectFromIntersectingNodes(this);

                Center = newCenter; // set new state
            }
        }
 public ContainmentType ContainedInNode(ClientPhysicsQuadTreeNode _node)
 {
     return(_node.NodeData.BoundingBox.xna().Contains(new BoundingSphere(Center, Radius)));
 }