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

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

Add(Libraries.Game.Physics.Joints.Joint2D joint)

This action adds a contraint to the items.

Parameters

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

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

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)

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.

Parameters

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)

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.

Return

integer: The integer hash code of the object.

Example

Object o
integer hash = o:GetHashCode()

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

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.

Parameters