Libraries.Game.Collision.DynamicBoundingVolumeTree3D Documentation
DynamicBoundingVolumeTree2D is the tree structure for storing the bounding boxes for 2D objects that are able to collide. The tree is a complete binary tree and stores the bounding boxes in a hierarchal structure with the parent node containing a bounding box that bounds the bounding boxes of both of its children.
Inherits from: Libraries.Language.Object
Variables Table
Variables | Description |
---|---|
integer NULL_NODE |
Actions Documentation
Compare(Libraries.Language.Object object)
This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.
Parameters
- Libraries.Language.Object: The object to compare to.
Return
integer: The Compare result, Smaller, Equal, or Larger.
Example
Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)
ComputeHeight()
This action computes the height of the tree
Return
integer:
CountNodes()
This action returns the number of nodes in the DynamicBoundingVolumeTree3D tree.
Return
integer:
CountNodes(Libraries.Game.Collision.DynamicBoundingVolumeTreeNode3D node)
This action counts the number of nodes in the DynamicBoundingVolumeTree3D recursively.
Parameters
Return
integer:
CreateNode(Libraries.Game.BoundingBox boundingBox, Libraries.Game.Collision.Item3DNode node)
This action creates a new node for the Dynamic Bounding Volume Tree with the given BoundingBox and given Item and inserts the new node as a leaf for the tree.
Parameters
Return
integer:
DestroyNode(integer nodeID)
This action removes the node from the Dynamic Bounding Volume Tree with the given node ID.
Parameters
- integer nodeID
DestroyNode(Libraries.Game.Collision.DynamicBoundingVolumeTreeNode3D node)
This action removes the given node from the tree.
Parameters
Equals(Libraries.Language.Object object)
This action determines if two objects are equal based on their hash code values.
Parameters
- Libraries.Language.Object: The to be compared.
Return
boolean: True if the hash codes are equal and false if they are not equal.
Example
use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)
GetBoundingBox(Libraries.Game.Collision.DynamicBoundingVolumeTreeNode3D node)
This action returns the bounding box contained in the given tree node. Note that this bounding box is slightly larger than the bounding box of the item contained in this node.
Parameters
Return
GetBoundingBox(integer nodeID)
This action returns the bounding box contained in the tree node with the given ID. Note that this bounding box is slightly larger than the bounding box of the item contained in this node
Parameters
- integer nodeID
Return
GetHashCode()
This action gets the hash code for an object.
Return
integer: The integer hash code of the object.
Example
Object o
integer hash = o:GetHashCode()
GetHeight()
This action computes the height of the tree
Return
integer:
GetItemNode(integer nodeID)
This action returns the Item2Dcontained in the tree node with the given ID
Parameters
- integer nodeID
Return
GetItemNode(Libraries.Game.Collision.DynamicBoundingVolumeTreeNode3D node)
This action returns the Item2Dcontained in the given tree node
Parameters
Return
GetMaximumBalance()
This action computes the maximum balance of the tree. The maximum balance is the maximum difference of the heights of the two children of any node.
Return
integer:
GetNodeCount()
This action returns the bounding box contained in the given tree node. Note that this bounding box is slightly larger than the bounding box of the item contained in this node.
Return
integer:
GetPerimeterRatio()
This actoin computes the ratio of the sum of the node perimeters to the root perimeter.
Return
number:
MoveNode(Libraries.Game.Collision.DynamicBoundingVolumeTreeNode3D node, Libraries.Game.BoundingBox boundingBox, Libraries.Compute.Vector3 displacement)
This action moves the object. If the object moves outside of its existing big bounding box, then the object is removed from the tree, a new bounding box is calculated, and it is reinserted into the tree. Otherwise, the action returns immediately.
Parameters
- Libraries.Game.Collision.DynamicBoundingVolumeTreeNode3D
- Libraries.Game.BoundingBox
- Libraries.Compute.Vector3
Return
boolean: Whether the item is reinserted into the tree
MoveNode(integer nodeID, Libraries.Game.BoundingBox boundingBox, Libraries.Compute.Vector3 displacement)
This action moves the object contained in the node with the given node ID by the given displacement vector. If the node moves outside of its existing bounding box, then the object is removed from the tree, a new bounding box is calculated, and it is reinserted into the tree. Otherwise, the node is left where it is in the tree.
Parameters
- integer nodeID
- Libraries.Game.BoundingBox
- Libraries.Compute.Vector3
Return
boolean: Returns whether the item is reinserted into the tree
Query(Libraries.Game.Collision.BroadphaseCollision3D broadphase, Libraries.Game.BoundingBox boundingBox)
This action queries the tree for bounding boxes that overlap with the given bounding box and returns all leafs whose bounding boxes intersect the given bounding box in a list.
Parameters
- Libraries.Game.Collision.BroadphaseCollision3D
- Libraries.Game.BoundingBox: The BoundingBox2D we are checking for overlap with
On this page
Variables TableAction Documentation- Compare(Libraries.Language.Object object)
- ComputeHeight()
- CountNodes()
- CountNodes(Libraries.Game.Collision.DynamicBoundingVolumeTreeNode3D node)
- CreateNode(Libraries.Game.BoundingBox boundingBox, Libraries.Game.Collision.Item3DNode node)
- DestroyNode(integer nodeID)
- DestroyNode(Libraries.Game.Collision.DynamicBoundingVolumeTreeNode3D node)
- Equals(Libraries.Language.Object object)
- GetBoundingBox(Libraries.Game.Collision.DynamicBoundingVolumeTreeNode3D node)
- GetBoundingBox(integer nodeID)
- GetHashCode()
- GetHeight()
- GetItemNode(integer nodeID)
- GetItemNode(Libraries.Game.Collision.DynamicBoundingVolumeTreeNode3D node)
- GetMaximumBalance()
- GetNodeCount()
- GetPerimeterRatio()
- MoveNode(Libraries.Game.Collision.DynamicBoundingVolumeTreeNode3D node, Libraries.Game.BoundingBox boundingBox, Libraries.Compute.Vector3 displacement)
- MoveNode(integer nodeID, Libraries.Game.BoundingBox boundingBox, Libraries.Compute.Vector3 displacement)
- Query(Libraries.Game.Collision.BroadphaseCollision3D broadphase, Libraries.Game.BoundingBox boundingBox)