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 class.

Inherits from: Libraries.Language.Object

Summary

Variable Summary Table

VariablesDescription
integer POLYGON
integer EDGE
integer CHAIN
integer CIRCLE

Actions Summary Table

ActionsDescription
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns a CompareResult.
ComputeArea()This action finds the area of a CollisionShape2D.
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 CollisionShape2D.
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 shape.
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 shape.
SetType(integer type)This action sets the type of the shape that will be used to collide with another 2D shape.
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 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.

ComputeArea()

This action finds the area of a CollisionShape2D.

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 CollisionShape2D.

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

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 shape.

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 shape.

Parameters

SetType(integer type)

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

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: