Libraries.Game.Collision.Shapes.CollisionShape2D Documentation

This class includes the features for all of the 2D shapes that could be used to determine collision with other 2D shapes. Please see the Circle and the Polygon class for the implementation of the blueprints in this clas

Inherits from: Libraries.Language.Object

Summary

Variable Summary Table

VariablesDescription
integer CHAINthe default type is POLYG
integer CIRCLE
integer EDGE
integer POLYGON

Actions Summary Table

ActionsDescription
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
ComputeArea()This action finds the area of a CollisionShape2
ComputeBoundingBox(Libraries.Game.Collision.BoundingBox2D boundingBox, Libraries.Game.Collision.PhysicsPosition2D transform, integer childIndex)When you pass in the location of the 2D object (PhysicsPosition2D transform), this action will help you return what the bounding box "BoundingBox2D boundingBox" will look like for the shape's child #"integer childIndex".
ComputeDistance(Libraries.Game.Collision.PhysicsPosition2D transform, Libraries.Compute.Vector2 point, integer childIndex, Libraries.Compute.Vector2 normalOut)This action finds the distance of a point relative to the edge of the shape.
ComputeMass(Libraries.Game.Physics.Mass2D mass, number density)This action finds the mass of a 2D object based on the shape of the object and the design of the object.
Copy()This action returns a copy of this CollisionShape2
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GetChildCount()Child Shape: a more primitive shape (circle, rectangle, edge) that makes up this shape.
GetHashCode()This action gets the hash code for an object.
GetRadius()This action returns the radius of the shape.
GetType()This action gets the type of the shape that is used to collide with another 2D shap
Scale(number scaleX, number scaleY)This action scales the CollisionShape2D in both x and y directions for polygons and scales the a circle uniformly.
SetRadius(number radius)This action sets the radius of the shap
SetType(integer type)This action sets the type of the shape that will be used to collide with another 2D shap
TestPoint(Libraries.Game.Collision.PhysicsPosition2D transform, Libraries.Compute.Vector2 point)For convex shapes, this will see if the "Vector2 point," in global coordiantes, that you passed in is a point inside that convex shape.

Actions Documentation

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

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

ComputeArea()

This action finds the area of a CollisionShape2

Return

number:

ComputeBoundingBox(Libraries.Game.Collision.BoundingBox2D boundingBox, Libraries.Game.Collision.PhysicsPosition2D transform, integer childIndex)

When you pass in the location of the 2D object (PhysicsPosition2D transform), this action will help you return what the bounding box "BoundingBox2D boundingBox" will look like for the shape's child #"integer childIndex".

Parameters

ComputeDistance(Libraries.Game.Collision.PhysicsPosition2D transform, Libraries.Compute.Vector2 point, integer childIndex, Libraries.Compute.Vector2 normalOut)

This action finds the distance of a point relative to the edge of the shape.

Parameters

Return

number:

ComputeMass(Libraries.Game.Physics.Mass2D mass, number density)

This action finds the mass of a 2D object based on the shape of the object and the design of the object.

Parameters

Copy()

This action returns a copy of this CollisionShape2

Return

Libraries.Game.Collision.Shapes.CollisionShape2D:

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(

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

GetChildCount()

Child Shape: a more primitive shape (circle, rectangle, edge) that makes up this shape.

Return

integer:

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.

GetRadius()

This action returns the radius of the shape.

Return

number:

GetType()

This action gets the type of the shape that is used to collide with another 2D shap

Return

integer:

Scale(number scaleX, number scaleY)

This action scales the CollisionShape2D in both x and y directions for polygons and scales the a circle uniformly.

Parameters

SetRadius(number radius)

This action sets the radius of the shap

Parameters

SetType(integer type)

This action sets the type of the shape that will be used to collide with another 2D shap

Parameters

TestPoint(Libraries.Game.Collision.PhysicsPosition2D transform, Libraries.Compute.Vector2 point)

For convex shapes, this will see if the "Vector2 point," in global coordiantes, that you passed in is a point inside that convex shape.

Parameters

Return

boolean: