Libraries.Game.Collision.PhysicsPosition2D Documentation

This class stores coordinate systems in 2D space, where the coordinate system represent the position of the 2D item and the tilt of the 2D item with respect to your screen. NOTE: this class can be seen as the class that stores a 3x3 transformation matrix.

Inherits from: Libraries.Language.Object

Summary

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.
GetAngle()This action gets the tilt of the 2D object in radians.
GetCosine()This action gets the cosine of the tilt of the 2D object described by this PhysicsPosition2D.
GetHashCode()This action gets the hash code for an object.
GetPosition()This action gets the location of the 2D object (the 2D object's local origin) with respect to the global coordinates.
GetSine()This action gets the sine of the tilt of the 2D object.
Multiply(Libraries.Game.Collision.PhysicsPosition2D transformA, Libraries.Game.Collision.PhysicsPosition2D transformB)If the 2D object B's location is described from the point of view of the object "A," and this point of view is stored inside "PhysicsPosition2D transformB," and that the location of A is described from someone sitting at the global origin, and this point of view is stored inside "PhysicsPosition2D transformA," then this action finds out what would be the position and tilt of object B from someone that is sitting at the global origin.
Multiply(Libraries.Game.Collision.PhysicsPosition2D transform, Libraries.Compute.Vector2 vector)Given a point (Vector2 vector) relative to the local coordinates of a 2D object described by "PhysicsPosition2D transform," this action computes that point relative to the global coordinates.
MultiplyAndTranslate(Libraries.Game.Collision.PhysicsPosition2D transform, Libraries.Compute.Vector2 vector)Given a vector "Vector2 vector" that is in global coordinates, this action computes what "Vector2 vector" will be at relative to the object that has the positions at "PhysicsPosition2D transform.
MultiplyAndTranslate(Libraries.Game.Collision.PhysicsPosition2D transformA, Libraries.Game.Collision.PhysicsPosition2D transformB)This action computes what is the tilt and position of object B described by "PhysicsPosition2D transformB" relative to object A described by "PhysicsPosition2D transformA.
MultiplyToOut(Libraries.Game.Collision.PhysicsPosition2D transform, Libraries.Compute.Vector2 vector, Libraries.Compute.Vector2 out)Given a point (Vector2 vector) relative to the center of this item (PhysicsPosition2D transform), this action computes and returns that point in screen coordinates (Vector2 out).
Set(Libraries.Compute.Vector2 position, number angle)This action sets the physics position of the 2D object using the passed in position and sets the tilt of the 2D object using the angle passed in.
Set(Libraries.Game.Collision.PhysicsPosition2D other)This action sets the physics positions using another object of PhysicsPosition2D.
SetCosine(number cosine)This action sets the cosine of the tilt of the 2D object described by this PhysicsPosition2D.
SetPosition(Libraries.Compute.Vector2 position)This action sets the position of the 2D object (the 2D object's local origin with respect to the global coordinates).
SetSine(number sine)This action sets the sine of the tilt of the 2D object.
SetToIdentity()This action sets the tilt of the 2D object described by this PhysicsPosition2D to 0 and align the 2D object with the global origin.

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.

GetAngle()

This action gets the tilt of the 2D object in radians.

Return

number: the tilt of the 2D object in radians.

GetCosine()

This action gets the cosine of the tilt of the 2D object described by this PhysicsPosition2D. To learn more about cosine, you can visit the tutorial page by MathIsFun: https://www.mathsisfun.com/sine-cosine-tangent.html

Return

number: the cosine of the tilt of the 2D object.

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.

GetPosition()

This action gets the location of the 2D object (the 2D object's local origin) with respect to the global coordinates.

Return

Libraries.Compute.Vector2: the current position of the 2D object.

GetSine()

This action gets the sine of the tilt of the 2D object. To learn more about sine, you can visit the tutorial page by MathIsFun: https://www.mathsisfun.com/sine-cosine-tangent.html

Return

number: the sine of the tilt of the 2D object.

Multiply(Libraries.Game.Collision.PhysicsPosition2D transformA, Libraries.Game.Collision.PhysicsPosition2D transformB)

If the 2D object B's location is described from the point of view of the object "A," and this point of view is stored inside "PhysicsPosition2D transformB," and that the location of A is described from someone sitting at the global origin, and this point of view is stored inside "PhysicsPosition2D transformA," then this action finds out what would be the position and tilt of object B from someone that is sitting at the global origin. In mathematical terms, this would be T_A * T_B, where T_A and T_B are both transformation matrices.

Parameters

Return

Libraries.Game.Collision.PhysicsPosition2D: the position of object B from the point of view from someone at the global origin.

Multiply(Libraries.Game.Collision.PhysicsPosition2D transform, Libraries.Compute.Vector2 vector)

Given a point (Vector2 vector) relative to the local coordinates of a 2D object described by "PhysicsPosition2D transform," this action computes that point relative to the global coordinates. The result is returned instead of changed within the function.

Parameters

Return

Libraries.Compute.Vector2: the point described from the point of view of someone sitting on the origin of the glocal coordinates.

MultiplyAndTranslate(Libraries.Game.Collision.PhysicsPosition2D transform, Libraries.Compute.Vector2 vector)

Given a vector "Vector2 vector" that is in global coordinates, this action computes what "Vector2 vector" will be at relative to the object that has the positions at "PhysicsPosition2D transform."

Parameters

Return

Libraries.Compute.Vector2: the point described from the point of view of the 2D object.

MultiplyAndTranslate(Libraries.Game.Collision.PhysicsPosition2D transformA, Libraries.Game.Collision.PhysicsPosition2D transformB)

This action computes what is the tilt and position of object B described by "PhysicsPosition2D transformB" relative to object A described by "PhysicsPosition2D transformA." Currently, this action is not used in any other classes.

Parameters

Return

Libraries.Game.Collision.PhysicsPosition2D: the position of B relative to the position of A.

MultiplyToOut(Libraries.Game.Collision.PhysicsPosition2D transform, Libraries.Compute.Vector2 vector, Libraries.Compute.Vector2 out)

Given a point (Vector2 vector) relative to the center of this item (PhysicsPosition2D transform), this action computes and returns that point in screen coordinates (Vector2 out). This action stores the result inside of "Vector2 out."

Parameters

Set(Libraries.Compute.Vector2 position, number angle)

This action sets the physics position of the 2D object using the passed in position and sets the tilt of the 2D object using the angle passed in.

Parameters

Set(Libraries.Game.Collision.PhysicsPosition2D other)

This action sets the physics positions using another object of PhysicsPosition2D.

Parameters

SetCosine(number cosine)

This action sets the cosine of the tilt of the 2D object described by this PhysicsPosition2D. To learn more about sine, you can visit the tutorial page by MathIsFun: https://www.mathsisfun.com/sine-cosine-tangent.html

Parameters

SetPosition(Libraries.Compute.Vector2 position)

This action sets the position of the 2D object (the 2D object's local origin with respect to the global coordinates).

Parameters

SetSine(number sine)

This action sets the sine of the tilt of the 2D object. To learn more about sine, you can visit the tutorial page by MathIsFun: https://www.mathsisfun.com/sine-cosine-tangent.html

Parameters

SetToIdentity()

This action sets the tilt of the 2D object described by this PhysicsPosition2D to 0 and align the 2D object with the global origin.