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

ActionsDescription
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 a CompareResult.
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

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 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.

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

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

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

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

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

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