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

Summary

Variable Summary Table

VariablesDescription
integer CIRCLESthe reference object will be selected as circl
integer FACE_Athe reference object will be selected as circl
integer FACE_Bin a circle-polygon collision, the polygon will be selected as the reference obje
integer MAX_COLLISION_POINTS

Actions Summary Table

ActionsDescription
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GetHashCode()This action gets the hash code for an object.
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.
GetLocalPoint()This action returns the estimated point of contact.
GetPointCount()This action returns 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.
GetType()This action returns the type of the collision.
Set(Libraries.Game.Collision.LocalCollisionPoints2D other)This action sets the current LocalCollisionPoints2D with another LocalCollisionPoints2D.
SetLocalNormal(Libraries.Compute.Vector2 normal)This action sets the direction that you should apply the normal impulse to the objects to separate the objects.
SetLocalPoint(Libraries.Compute.Vector2 point)This action sets the estimated point of contact.
SetPointCount(integer count)This action sets how many collision points there is between two objects.
SetType(integer type)This action sets the type of collision.

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.

Example Code

Object o
        Object t
        integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

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.

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.

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:

Example Code

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

Return

integer:

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

SetType(integer type)

This action sets the type of collision.

Parameters