Libraries.Game.Collision.Sweep2D Documentation

Let time step be defined as the amount of time it is necessary to update the physics of a 2D mass. This class calculates the orientation and location of a mass in 2D between time steps in order to calculate when this 2D mass might collide with another 2D mass (Time of Impact (TOI)), ideally, before the frame update so we can catch a collision before the frame update and not have objects penetrate through other objects when they are not supposed to.

Inherits from: Libraries.Language.Object

Actions Documentation

Advance(number alpha)

This action will actually set where the object is for sure, however, the object won't be drawn in the new position until the next frame update. This action is useful when the time step of your physics updates are larger than the frame rate. Note: center0, angle0 is what will be drawn to the screen.

Parameters

  • number alpha: A fraction of the time step that is > than alpha0.

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)

GetAlpha0()

This action gets the percentage of how much of the current time step your physics are evaluated at.

Return

number: the percentage of how much of the current time step your physics are evaluated at.

GetAngle()

This action gets the target tilt of the 2D object relative to the global coordinates.

Return

number: the target tilt of the 2D object relative to the global coordinates.

GetAngle0()

This action gets the current tilt of the 2D object relative to the global coordinates.

Return

number: the current tilt of the 2D object relative to the global coordinates.

GetCenter()

This action gets the target center of the object relative to the global coordinates.

Return

Libraries.Compute.Vector2:

GetCenter0()

This action gets the current center of the object relative to the global coordinates.

Return

Libraries.Compute.Vector2: the current center of the object relative to the global coordinates.

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

GetLocalCenter()

This action returns the center of the object relative to the local coordinates of the object. You can change the local center of the object from the vector that is returned.

Return

Libraries.Compute.Vector2: the center of the object relative to the local coordinates of the object.

Example

use Libraries.Game.Collision.Sweep2D
sweep:GetLocalCenter():SetLocalCenter(center)

GetTransform(Libraries.Game.Collision.PhysicsPosition2D transform, number beta)

This action tells you what the transformed object will look like some time between the time intervals of physics updates. This will not change the orientation of the object yet.

Parameters

Normalize()

This action normalizes the angles in radians between -pi and pi.

Set(Libraries.Game.Collision.Sweep2D sweep)

This action is setting a sweep using another sweep object.

Parameters

SetAlpha0(number alpha0)

This action sets the percentage of how much of the current time step your physics are evaluated at.

Parameters

  • number alpha0: The percentage of how much of the current time step your physics are evaluated at.

SetAngle(number angle)

This action sets the target tilt of the 2D object relative to the global coordinates.

Parameters

  • number angle: The target tilt of the 2D object relative to the global coordinates.

SetAngle0(number angle0)

This action sets the current tilt of the 2D obejct relative to the global coordinates.

Parameters

  • number angle0: The current tilt of the 2D obejct relative to the global coordinates.

SetCenter(Libraries.Compute.Vector2 center)

This action sets the target center of the object relative to the global coordinates.

Parameters

SetCenter0(Libraries.Compute.Vector2 center)

This action sets the current center of the object relative to the global coordinates.

Parameters

SetLocalCenter(Libraries.Compute.Vector2 center)

This action sets the center of the object relative to the local coordinates of the object.

Parameters