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

Summary

Actions Summary Table

ActionsDescription
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.
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.
GetAlpha0()This action gets 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.
GetAngle0()This action gets 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.
GetCenter0()This action gets the current center of the object relative to the global coordinates.
GetHashCode()This action gets the hash code for an object.
GetLocalCenter()This action returns the center of the object relative to the local coordinates of the object.
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.
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.
SetAlpha0(number alpha0)This action sets 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.
SetAngle0(number angle0)This action sets 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.
SetCenter0(Libraries.Compute.Vector2 center)This action sets the current center of the object relative to the global coordinates.
SetLocalCenter(Libraries.Compute.Vector2 center)This action sets the center of the object relative to the local coordinates of the 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

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.

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.

Example Code

Object o
        integer hash = o:GetHashCode()

Return

integer: The integer hash code of the object.

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.

Example Code

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

Return

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

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

SetAngle(number angle)

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

Parameters

SetAngle0(number angle0)

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

Parameters

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