public void Move(ClientPhysicsQuadTreeNode root, Matrix newPose) { if (actor == null) { throw new InvalidOperationException(); } // NOTE: IMPORTANT: this is actually a partial implementation of the algorithm itself Matrix oldPose = World; ClientPhysicsQuadTreeNode oldNode = Node; // Update location in quadtree world = newPose; root.OrdenObject(this); // Update dynamic object count Node.AddDynamicObjectToIntersectingNodes(this); // Add must come before remove to prevent overhead if (oldNode != null) { world = oldPose; // set old state oldNode.RemoveDynamicObjectFromIntersectingNodes(this); world = newPose; // set new state } }
internal void disposeInternal() { if (actor != null) { actor.Dispose(); if (!sleeping) { node.RemoveDynamicObjectFromIntersectingNodes(this); } actor = null; } }
/// <summary> /// This updates the position of the client physics object to the controller's position, /// and updates the dynamicobjectscount in the Client Physics /// This uses the dynamic object trick /// </summary> public void Update(ClientPhysicsQuadTreeNode root) { // First adds count, then removes. This is simply to ensure that objects are not flicked on of this frame Vector3 oldPosition = currentPosition; Vector3 newPosition = controller.GlobalPosition; currentPosition = newPosition; ClientPhysicsQuadTreeNode oldNode = node; root.OrdenObject(this); node.AddDynamicObjectToIntersectingNodes(this); if (oldNode != null) { currentPosition = oldPosition; oldNode.RemoveDynamicObjectFromIntersectingNodes(this); currentPosition = newPosition; } }
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 } }
internal void disposeInternal() { //TODO: node.RemoveDynamicObjectFromIntersectingNodes(this); }