Libraries.Interface.Events.CollisionEvent2D Documentation

This class is used to represent collision between two 2D items. One CollisionEvent2D corresponds to one collision between the two items. This class also has a doubly linked list structure which allows you to access all of the collision events that has happened. This doubly linked list encompasses the collision that happened in the whole "world" of a certain game.

Inherits from: Libraries.Language.Object

Summary

Variable Summary Table

VariablesDescription
number EPSILONA floating point value that is very close to zer

Actions Summary Table

ActionsDescription
CalculateTotalFriction(number friction1, number friction2)This action estimates the friction between the surface of the two 2D objects using friction mixing law such that if one object is frictionless then the surface between the two objects will have 0 friction as well.
CalculateTotalRestitution(number restitution1, number restitution2)This action estimates the restitution between the surface of the two 2D objects using restitution mixing law such that if one object is inelastic, then the other object will bounce off the inelastic object easily.
ClipSegmentToLine(Libraries.Containers.Array<Libraries.Game.Collision.ClipVertex2D> vOut, Libraries.Containers.Array<Libraries.Game.Collision.ClipVertex2D> vIn, Libraries.Compute.Vector2 normal, number offset, integer vertexIndexA)This action finds the collision point on the incident edge.
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns a CompareResult.
DispatchCollision(Libraries.Containers.Array<Libraries.Interface.Events.CollisionListener2D> listeners)This action calculates if the collision has started or if the collision has been resolved.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GetChildIndexA()
GetChildIndexB()
GetCollisionPoints()
GetFriction()
GetHashCode()This action gets the hash code for an object.
GetItemA()
GetItemB()
GetNext()first shape, so we can just assign the values as they come
GetNodeA()let p2 be the most current evaluation of collisionPoin
GetNodeB()calculate the new "collisionPoint
GetPrevious()local collision poin
GetRestitution()
GetTangentSpeed()
GetTimeOfImpact()
GetTimeOfImpactCount()this would be the reference polyg
HasPhysicsResponse()
InCollisionGroup()A becomes the indicent polyg
Initialize(Libraries.Interface.Item2D itemA, integer indexA, Libraries.Interface.Item2D itemB, integer indexB)
IsEnabled()
IsTouching()
ResetFriction()
ResetRestitution()
SetEnabled(boolean enabled)
SetFriction(number friction)
SetHasPhysicsResponse(boolean flag)
SetInCollisionGroup(boolean flag)when the circles are NOT colliding, retu
SetNext(Libraries.Interface.Events.CollisionEvent2D event)this assumes that each item is made up of one sha
SetPrevious(Libraries.Interface.Events.CollisionEvent2D event)other way around, so flip them he
SetRestitution(number restitution)
SetTangentSpeed(number speed)
SetTimeOfImpact(number toi)
SetTimeOfImpactCount(integer count)this would be the incident polyg
SetTimeOfImpactSolved(boolean flag)B becomes the reference polyg
TimeOfImpactSolved()this stores the index of the reference ed

Actions Documentation

CalculateTotalFriction(number friction1, number friction2)

This action estimates the friction between the surface of the two 2D objects using friction mixing law such that if one object is frictionless then the surface between the two objects will have 0 friction as well.

Parameters

Return

number:

CalculateTotalRestitution(number restitution1, number restitution2)

This action estimates the restitution between the surface of the two 2D objects using restitution mixing law such that if one object is inelastic, then the other object will bounce off the inelastic object easily.

Parameters

Return

number:

ClipSegmentToLine(Libraries.Containers.Array<Libraries.Game.Collision.ClipVertex2D> vOut, Libraries.Containers.Array<Libraries.Game.Collision.ClipVertex2D> vIn, Libraries.Compute.Vector2 normal, number offset, integer vertexIndexA)

This action finds the collision point on the incident edge.

Parameters

Return

integer:

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.

DispatchCollision(Libraries.Containers.Array<Libraries.Interface.Events.CollisionListener2D> listeners)

This action calculates if the collision has started or if the collision has been resolved. Using a CollisionListener, the user can change what would the responses of the system (ex. audio playback) and the objects be when the collision has begun or when the collision has ended.

Parameters

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.

GetChildIndexA()

Return

integer

GetChildIndexB()

Return

integer

GetCollisionPoints()

Return

Libraries.Game.Collision.LocalCollisionPoints2D

GetFriction()

Return

number

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.

GetItemA()

Return

Libraries.Interface.Item2D

GetItemB()

Return

Libraries.Interface.Item2D

GetNext()

first shape, so we can just assign the values as they come

Return

Libraries.Interface.Events.CollisionEvent2D:

GetNodeA()

let p2 be the most current evaluation of collisionPoin

Return

Libraries.Game.Collision.CollisionEdge2D:

GetNodeB()

calculate the new "collisionPoint

Return

Libraries.Game.Collision.CollisionEdge2D:

GetPrevious()

local collision poin

Return

Libraries.Interface.Events.CollisionEvent2D:

GetRestitution()

Return

number

GetTangentSpeed()

Return

number

GetTimeOfImpact()

Return

number

GetTimeOfImpactCount()

this would be the reference polyg

Return

integer:

HasPhysicsResponse()

Return

boolean

InCollisionGroup()

A becomes the indicent polyg

Return

boolean:

Initialize(Libraries.Interface.Item2D itemA, integer indexA, Libraries.Interface.Item2D itemB, integer indexB)

Parameters

IsEnabled()

Return

boolean

IsTouching()

Return

boolean

ResetFriction()

ResetRestitution()

SetEnabled(boolean enabled)

Parameters

SetFriction(number friction)

Parameters

SetHasPhysicsResponse(boolean flag)

Parameters

SetInCollisionGroup(boolean flag)

when the circles are NOT colliding, retu

Parameters

SetNext(Libraries.Interface.Events.CollisionEvent2D event)

this assumes that each item is made up of one sha

Parameters

SetPrevious(Libraries.Interface.Events.CollisionEvent2D event)

other way around, so flip them he

Parameters

SetRestitution(number restitution)

Parameters

SetTangentSpeed(number speed)

Parameters

SetTimeOfImpact(number toi)

Parameters

SetTimeOfImpactCount(integer count)

this would be the incident polyg

Parameters

SetTimeOfImpactSolved(boolean flag)

B becomes the reference polyg

Parameters

TimeOfImpactSolved()

this stores the index of the reference ed

Return

boolean: