Skip to content

Interface: IShape

IShape is the interface for a shape, defining all methods that need implemented in order for the shape to be used with collision detection.

Hierarchy

Implemented by

Table of contents

Methods

Methods

Center

Center(): Vector

Center calculates/retrieves the center of a shape.

Returns: Vector

The center point of the shape


Copy

Copy(): IShape

Creates a copy of the shape and its values, rather than pointing to the same Shape.

Returns: IShape

The value copy of the Shape


FarthestPointInDirection

FarthestPointInDirection(direction: Vector): Vector

FarthestPointInDirection returns the point that is farthest in the direction provided. Used in the GJK algorithm for collision detection.

Parameters:

Name Type Description
direction Vector The direction to get the point in

Returns: Vector

The farthest point in the direction provided


Free

Free(): void

Free releases an object or it's constituent parts back into any available object pools.

Returns: void

Inherited from: IFreeable


PointInside

PointInside(point: Vector): boolean

PointInside determines if a point provided is within the shape or not.

Parameters:

Name Type Description
point Vector The point to check if it is inside the shape

Returns: boolean

If the point is inside the shape, true = inside, false = outside


Transform

Transform(transform: Transform): IShape

Transform takes a transform and applies it to shape.

Parameters:

Name Type Description
transform Transform The transform to apply to the shape

Returns: IShape

The transformed shape