Libraries.Game.Collision.BroadphaseCollision3D Documentation
BroadphaseCollision3D uses the DynamicBoundingVolumeTree3D to compute the pairs of two objects that are colliding. Only objects that are collideable are compared to see if they collide. This class is used by CollisionManager3D.
Inherits from: Libraries.Language.Object
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)
CountNodes()
This action returns number of nodes in the DynamicBoundingVolumeTree3D tree.
Return
integer: the number of nodes in the DynamicBoundingVolumeTree3D tree.
CreateNode(Libraries.Game.BoundingBox boundingBox, Libraries.Game.Collision.Item3DNode item)
This action adds the BoundingBox and Item3DNode passed in to the "tree" as a node to that "tree" in this BoardphaseCollision3D class. The newly added node will be assigned an integer identification number.
Parameters
- Libraries.Game.BoundingBox: The BoundingBox of the item to be inserted into the tree.
- Libraries.Game.Collision.Item3DNode: The ItemNode3D of the item being inserted into the tree.
Return
integer: The integer id of the new tree node
DestroyNode(integer id)
This action removes the node from the "tree" in this BoardphaseCollision3D class with the id passed in.
Parameters
- integer id: The integer id number for the node which is to be removed
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(integer id)
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 id: The integer id of the tree node containing the BoundingBox3D to be returned
Return
Libraries.Game.BoundingBox: the specified BoundingBox3D
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()
GetItemNode(integer id)
This action returns the Item3DNode contained in the tree node with the given ID This is an internal action.
Parameters
- integer id: The integer id of the tree node containing the Item3DNode to be returned
Return
Libraries.Game.Collision.Item3DNode: The specified Item3DNode
GetNodeCount()
This action returns the number of nodes in the dynamic bounding volume tree. This action is used internally.
Return
integer: The number of nodes in the tree.
GetTreeBalance()
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. Attributes: Returns the maximum balance of the tree.
Return
integer:
GetTreeHeight()
This action returns the height of the tree.
Return
integer: the height of the tree
GetTreeQuality()
This action computes the quality of the tree (the ratio of the sum of the node perimeters to the root perimeter).
Return
number: the perimeter ratio of the tree
MoveNode(integer id, Libraries.Game.BoundingBox boundingBox, Libraries.Compute.Vector3 displacement)
This action moves the Item3D that is contained in the tree node with the given "id" by the given "displacement" vector. If the Item3D moves outside of its existing bounding box, then the 3D object is removed from the tree, then a new bounding box will be calculated for that 3D object, and the 3D object is reinserted into the tree. Otherwise, the node wil stay at where it is in the tree.
Parameters
- integer id: The id of the node that is to be moved.
- Libraries.Game.BoundingBox: The boundingBox of the node to be moved.
- Libraries.Compute.Vector3: The displacement of the 3D object.
Query(Libraries.Game.Collision.BroadphaseCollision3D broadphase, Libraries.Game.BoundingBox boundingBox)
This action finds whether if any bounding boxes in the tree overlaps with the bounding box that is passed in.
Parameters
- Libraries.Game.Collision.BroadphaseCollision3D: The BroadphaseCollision2D which contains the tree to check the BoundingBox2D against
- Libraries.Game.BoundingBox: The BoundingBox2D we are checking for overlap with
ShouldProceed(integer id)
This action adds the given node to the pair list with the query node, if the given node is not the query node. This action is used internally.
Parameters
- integer id: The integer id of the node to be paired
Return
boolean: whether the should proceed (always true)
TestOverlap(integer idA, integer idB)
This action checks to see if the bounding boxes of two nodes overlap. This action is used internally.
Parameters
- integer idA: The integer id of one of the nodes to be checked.
- integer idB: The integer id of the other node to be checked.
Return
boolean: a boolean value that indicates whether the two nodes overlap.
TouchNode(integer nodeID)
This action adds the node with the given id to the move list (the list of 3D objects that needs to be moved because the objects' displacements changed). We call this process as "touching the node."
Parameters
- integer nodeID: The id of the node to be touched.
UpdatePairs(Libraries.Game.Collision.CollisionManager3D collision)
This action updates the list of collideable pairs from the tree. This action is used internally
Parameters
- Libraries.Game.Collision.CollisionManager3D: The CollisionManager3D containing the relevant collision information.
On this page
Variables TableAction Documentation- Compare(Libraries.Language.Object object)
- CountNodes()
- CreateNode(Libraries.Game.BoundingBox boundingBox, Libraries.Game.Collision.Item3DNode item)
- DestroyNode(integer id)
- Equals(Libraries.Language.Object object)
- GetBoundingBox(integer id)
- GetHashCode()
- GetItemNode(integer id)
- GetNodeCount()
- GetTreeBalance()
- GetTreeHeight()
- GetTreeQuality()
- MoveNode(integer id, Libraries.Game.BoundingBox boundingBox, Libraries.Compute.Vector3 displacement)
- Query(Libraries.Game.Collision.BroadphaseCollision3D broadphase, Libraries.Game.BoundingBox boundingBox)
- ShouldProceed(integer id)
- TestOverlap(integer idA, integer idB)
- TouchNode(integer nodeID)
- UpdatePairs(Libraries.Game.Collision.CollisionManager3D collision)