Libraries.Game.Physics.CollisionGroup2D Documentation
This class is used to solve the physics between 2D objects that are in the same group. For example, a chain of joints would be considered to be in the same group. Groups are also known as islands.
Inherits from: Libraries.Language.Object
Summary
Actions Summary Table
Actions | Description |
---|---|
Add(Libraries.Interface.Events.CollisionEvent2D collision) | This action adds a CollisionEvent2D that is associated with an item that is inside this CollisionGroup2D. |
Add(Libraries.Game.Physics.Joints.Joint2D joint) | This action adds a contraint to the items. |
Add(Libraries.Interface.Item2D item) | This action adds a Item2D into the array of existing items to group these the new Item2D into the existing items. |
Compare(Libraries.Language.Object object) | This action compares two object hash codes and returns an integer. |
Empty() | This action resets all of the arrays involved in the class to an empty state. |
Equals(Libraries.Language.Object object) | This action determines if two objects are equal based on their hash code values. |
GetCollision(integer index) | This action returns the CollisionEvent2D requested at the index passed in. |
GetCollisionCount() | This action returns the number of collision events that is associated with this CollisionGroup2D. |
GetHashCode() | This action gets the hash code for an object. |
GetItem(integer index) | This action returns the Item2D requested at the index passed in. |
GetItemCount() | This action returns how many items are in the collision group. |
GetJoint(integer index) | This action returns the Join2D requested at the index passed in. |
GetJointCount() | This action returns how many joints are in this collision group. |
GetSimulationThreshold() | This action returns the maximum linear velocity that a sleeping object can have. |
SetSimulationThreshold(number threshold) | This action sets the maximum linear velocity that a sleeping object can have. |
Solve(Libraries.Game.Physics.TimeStep step, Libraries.Compute.Vector2 gravity, boolean requireSimulation) | This action solves the collision for objects inside this CollisionGroup2D. |
SolveTimeOfImpact(Libraries.Game.Physics.TimeStep subStep, integer timeOfImpactIndexA, integer timeOfImpactIndexB) | This action solves the time of impact for the objects that are in this CollisionGroup2D. |
Actions Documentation
Add(Libraries.Interface.Events.CollisionEvent2D collision)
This action adds a CollisionEvent2D that is associated with an item that is inside this CollisionGroup2D.
Parameters
- Libraries.Interface.Events.CollisionEvent2D: The CollisionEvent2D to add.
Add(Libraries.Game.Physics.Joints.Joint2D joint)
This action adds a contraint to the items.
Parameters
- Libraries.Game.Physics.Joints.Joint2D: The joint to add.
Add(Libraries.Interface.Item2D item)
This action adds a Item2D into the array of existing items to group these the new Item2D into the existing items.
Parameters
- Libraries.Interface.Item2D: The item to add.
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.
Example Code
Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)
Parameters
- Libraries.Language.Object: The object to compare to.
Return
integer: The Compare result, Smaller, Equal, or Larger.
Empty()
This action resets all of the arrays involved in the class to an empty state.
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
- Libraries.Language.Object: The to be compared.
Return
boolean: True if the hash codes are equal and false if they are not equal.
GetCollision(integer index)
This action returns the CollisionEvent2D requested at the index passed in.
Parameters
- integer index: The index of interest.
Return
Libraries.Interface.Events.CollisionEvent2D: a 2D collision event.
GetCollisionCount()
This action returns the number of collision events that is associated with this CollisionGroup2D.
Return
integer: the number of collision events.
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.
GetItem(integer index)
This action returns the Item2D requested at the index passed in.
Parameters
- integer index: The index of interest.
Return
Libraries.Interface.Item2D: a 2D item.
GetItemCount()
This action returns how many items are in the collision group.
Return
integer: the number of items are in the collision group.
GetJoint(integer index)
This action returns the Join2D requested at the index passed in.
Parameters
- integer index: The index of interest.
Return
Libraries.Game.Physics.Joints.Joint2D: a 2D joint.
GetJointCount()
This action returns how many joints are in this collision group.
Return
integer: the number of joints are in this collision group.
GetSimulationThreshold()
This action returns the maximum linear velocity that a sleeping object can have.
Return
number: the maximum linear velocity.
SetSimulationThreshold(number threshold)
This action sets the maximum linear velocity that a sleeping object can have.
Parameters
- number threshold: The maximum linear velocity.
Solve(Libraries.Game.Physics.TimeStep step, Libraries.Compute.Vector2 gravity, boolean requireSimulation)
This action solves the collision for objects inside this CollisionGroup2D.
Parameters
- Libraries.Game.Physics.TimeStep: The length of time step.
- Libraries.Compute.Vector2: The force of gravity.
- boolean requireSimulation: Whether this object will be stationary or not.
SolveTimeOfImpact(Libraries.Game.Physics.TimeStep subStep, integer timeOfImpactIndexA, integer timeOfImpactIndexB)
This action solves the time of impact for the objects that are in this CollisionGroup2D.