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

Actions Summary Table

ActionsDescription
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns a CompareResult.
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 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.

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