Libraries.Game.Collision.LocalCollisionPoints2D Documentation

This class records the all of the local collision points during one collision using the array called "points," from the perspective of one of the 2D object that is involved in the collision. This 2D object will be called as a reference object (because all of the local collision points are recorded from the perspective of that 2D object). Collision points will be evaluated when a CollisionEvent2D occurs, where the CollisionEvent2D uses the narrow phase evaluation to calculate where the collision points that are relative to the reference object (defined above). This class is also known as manifolds. This class is used by GlobalCollisionPoints2D.

Inherits from: Libraries.Language.Object

Variables Table

VariablesDescription
integer CIRCLESthe reference object will be selected as circleA
integer FACE_Athe reference object will be selected as circleA
integer MAX_COLLISION_POINTS
integer FACE_Bin a circle-polygon collision, the polygon will be selected as the reference 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

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)

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)

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()

GetLocalNormal()

This action returns the actual direction (with respect to the reference object) at which you should apply the normal impulse to the objects to separate the objects. In the case where the reference object is a circle (circleA), localNormal can't be used. In the case where the reference object is a polygon, localNormal would be the direction of normal impulse in reference to that polygon pointing away from the polygon.

Return

Libraries.Compute.Vector2: the direction that you should apply the normal impulse to the objects to separate the objects.

GetLocalPoint()

This action returns the estimated point of contact. In the case where the reference object is a circle, this would be the local center of circleA. In the case where the reference object is a polygon, this would be the local center of that polygon.

Return

Libraries.Compute.Vector2: the estimated point of contact.

GetPointCount()

This action returns how many collision points there is between two objects. 1 indicates that the collision caused a point contact, and 2 indicates that the collision caused a line contact.

Return

integer: how many collision points there is between two objects.

GetPoints()

This action returns all of the collision points stored inside this LocalCollisionPoints2D from the point of view of the reference object that is involved in the collision. The amount of items in the returning array tells you whether the contact is a line (2 CollisionPoint2D) or just a point (1 CollisionPoint2D object in the array).

Return

Libraries.Containers.Array: all of the collision points stored inside this LocalCollisionPoints2D.

GetType()

This action returns the type of the collision. Here are possible types in a code box for better viewing:

Return

integer:

Example

CIRCLES = 0 //when two circles collide, both 2D objects are going to be circles
                //the reference object will be selected as circleA
FACE_A = 1  //when circle collide with polygon -OR- polygon collide with polygon
                //the "type" of the LocalCollisionPoints2D is selected as FACE_A when A is the reference polygon
                //in a circle-polygon collision, the polygon will be selected as the reference object

FACE_B = 2  //when polygon collides with polygon
                //the "type" of the LocalCollisionPoints2D is selected as FACE_B when B is the reference polygon

Set(Libraries.Game.Collision.LocalCollisionPoints2D other)

This action sets the current LocalCollisionPoints2D with another LocalCollisionPoints2D.

Parameters

SetLocalNormal(Libraries.Compute.Vector2 normal)

This action sets the direction that you should apply the normal impulse to the objects to separate the objects.

Parameters

SetLocalPoint(Libraries.Compute.Vector2 point)

This action sets the estimated point of contact.

Parameters

SetPointCount(integer count)

This action sets how many collision points there is between two objects.

Parameters

  • integer count: How many collision points there is between two objects.

SetType(integer type)

This action sets the type of collision.

Parameters

  • integer type: The type of collision.