PolyShape2D

Inherits: Node2D < CanvasItem < Node < Object

Inherited By: PolyCollisionShape2D

The base class for implementing decomposition or mesh-based classes.

Description

Takes outlines from PolyNode2D added as children of this node and decomposes them into shapes determined by build_mode.

This class is used as a base for classes such as PolyCollisionShape2D and other related mesh-based objects in 2D.

Properties

BuildMode build_mode 0

Methods

void _apply_shapes ( ) virtual
Array get_shapes ( )

Signals

  • shapes_applied ( )

Emitted whenever the shapes are built and applied to some other object. The signal is emitted after _apply_shapes is called in all cases, so you don’t have to emit the signal manually.

Enumerations

enum BuildMode:

  • BUILD_TRIANGLES = 0 — Decomposes outlines into triangle shapes.
  • BUILD_CONVEX = 1 — Decomposes outlines into convex shapes.
  • BUILD_SEGMENTS = 2 — Filters outlines into outer outlines (mostly used to implement concave shapes).

Property Descriptions

Default 0
Setter set_build_mode(value)
Getter get_build_mode()

The mode to build shapes from PolyNode2D children.

Method Descriptions

  • void _apply_shapes ( ) virtual

Called whenever PolyNode2D outlines are updated, PolyNode2D children are added/removed, and when build_mode is changed.

Use get_shapes to construct new entities such as collision Shape2Ds from outlines. See also PolyCollisionShape2D.


Returns an array of PoolVector2Array polygon outlines previously built from build_mode.