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
Variables | Description |
---|---|
number EPSILON | A floating point value that is very close to zer |
Actions Summary Table
Actions | Description |
---|---|
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 an integer. |
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() | this assumes that each item is made up of one sha |
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 incident polyg |
HasPhysicsResponse() | The starting point of the doubly linked list of collisions on the second item that is involved in the collision. |
InCollisionGroup() | when the circles are NOT colliding, retu |
Initialize(Libraries.Interface.Item2D itemA, integer indexA, Libraries.Interface.Item2D itemB, integer indexB) | True when the shapes are touchin |
IsEnabled() | The first item involved in the collisio |
IsTouching() | you have to specify which "child" of itemA it i |
ResetFriction() | |
ResetRestitution() | |
SetEnabled(boolean enabled) | The second item involved in the collisio |
SetFriction(number friction) | |
SetHasPhysicsResponse(boolean flag) | False when the user doesn't want to count this as an collisio |
SetInCollisionGroup(boolean flag) | This action finds the collision point on the incident edge. |
SetNext(Libraries.Interface.Events.CollisionEvent2D event) | you have to specify which "child" of itemB it i |
SetPrevious(Libraries.Interface.Events.CollisionEvent2D event) | other way around, so flip them he |
SetRestitution(number restitution) | |
SetTangentSpeed(number speed) | |
SetTimeOfImpact(number toi) | this would be the reference polyg |
SetTimeOfImpactCount(integer count) | this stores the index of the reference ed |
SetTimeOfImpactSolved(boolean flag) | A becomes the indicent polyg |
TimeOfImpactSolved() | B becomes the reference polyg |
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 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
- Libraries.Language.Object: The object to compare to.
Return
integer: 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
- Libraries.Language.Object: The to be compared.
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
GetItemB()
Return
GetNext()
this assumes that each item is made up of one sha
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 incident polyg
Return
integer:
HasPhysicsResponse()
The starting point of the doubly linked list of collisions on the second item that is involved in the collision.
Return
boolean:
InCollisionGroup()
when the circles are NOT colliding, retu
Return
boolean:
Initialize(Libraries.Interface.Item2D itemA, integer indexA, Libraries.Interface.Item2D itemB, integer indexB)
True when the shapes are touchin
Parameters
IsEnabled()
The first item involved in the collisio
Return
boolean:
IsTouching()
you have to specify which "child" of itemA it i
Return
boolean:
ResetFriction()
ResetRestitution()
SetEnabled(boolean enabled)
The second item involved in the collisio
Parameters
SetFriction(number friction)
Parameters
SetHasPhysicsResponse(boolean flag)
False when the user doesn't want to count this as an collisio
Parameters
SetInCollisionGroup(boolean flag)
This action finds the collision point on the incident edge.
Parameters
SetNext(Libraries.Interface.Events.CollisionEvent2D event)
you have to specify which "child" of itemB it i
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)
this would be the reference polyg
Parameters
SetTimeOfImpactCount(integer count)
this stores the index of the reference ed
Parameters
SetTimeOfImpactSolved(boolean flag)
A becomes the indicent polyg
Parameters
TimeOfImpactSolved()
B becomes the reference polyg
Return
boolean: