An arbitrary polygon on the ground plane, extruded between minZ and maxZ.

Use this when no primitive fits: a police station's grounds, a race track sector, a gang territory that follows the streets. Trace the outline as a list of points in order (either winding direction works) — the shape closes itself, so don't repeat the first point at the end.

Containment is a standard ray-crossing test, which is exact for both convex and concave outlines. It costs one comparison pass per vertex, so the inherited boundingRadius rejection matters more here than for the primitive shapes.

Constructor

@:value({ maxZ : 1e9, minZ : -1e9 })new(points:Array<Vector3>, minZ:Float = -1e9, maxZ:Float = 1e9, ?id:String)

Parameters:

points

At least three outline points.

minZ

Floor height. Defaults to unbounded.

maxZ

Ceiling height. Defaults to unbounded.

Variables

maxZ:Float

Upper bound of the extrusion.

minZ:Float

Lower bound of the extrusion.

read onlypoints:Array<Vector3>

The outline, in order. Only X and Y are used; Z is ignored.

Methods

Inherited Variables

Defined by ColShape

center:Vector3

The shape's centre point.

data:Dynamic

Arbitrary user data carried along with the shape.

read onlyid:String

An identifier for this shape, useful for keying zone state. Assigned automatically if not given.

Inherited Methods

Defined by ColShape

inlinemightContain(point:Vector3):Bool

A cheap conservative test: false means point is definitely outside, true means contains is worth calling.