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

Summary

Actions Summary Table

ActionsDescription
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns a CompareResult.
CountNodes()This action returns 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.
DestroyNode(integer id)This action removes the node from the "tree" in this BoardphaseCollision3D class with the id passed in.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GetBoundingBox(integer id)This action returns the bounding box contained in the tree node with the given ID.
GetHashCode()This action gets the hash code for an object.
GetItemNode(integer id)This action returns the Item3DNode contained in the tree node with the given ID This is an internal action.
GetNodeCount()This action returns the number of nodes in the dynamic bounding volume tree.
GetTreeBalance()This action computes the maximum balance of the tree.
GetTreeHeight()This action returns 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).
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.
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.
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.
TestOverlap(integer idA, integer idB)This action checks to see if the bounding boxes of 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).
UpdatePairs(Libraries.Game.Collision.CollisionManager3D collision)This action updates the list of collideable pairs from the tree.

Actions Documentation

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns a CompareResult. The compare result is either larger if this hash code is larger than the object passed as a parameter, smaller, or equal.

Example Code

use Libraries.Language.Support.CompareResult
        Object o
        Object t
        CompareResult result = o:Compare(t)

Parameters

Return

Libraries.Language.Support.CompareResult: The Compare result, Smaller, Equal, or Larger.

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

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

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(t)

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

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

Return

Libraries.Game.BoundingBox: the specified BoundingBox3D

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode()

Return

integer: The integer hash code of the object.

GetItemNode(integer id)

This action returns the Item3DNode contained in the tree node with the given ID This is an internal action.

Parameters

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

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

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

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

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

UpdatePairs(Libraries.Game.Collision.CollisionManager3D collision)

This action updates the list of collideable pairs from the tree. This action is used internally

Parameters