Skip to content

PolygonCollider2D ​

Physics 2DScripts: PolygonCollider2DComponentFeature: 2D Physics (≈45 KB)

Optional feature

PolygonCollider2D is part of 2D Physics. A build includes it only when a scene, prefab or script uses it — see Feature cropping.

From a script ​

ts
import { PolygonCollider2DComponent } from "mmpx";

const polygonCollider2D = this.entity.TryGetComponent(PolygonCollider2DComponent);

Full API: PolygonCollider2DComponent.

Fields ​

FieldTypeDefaultDescription
Is Trigger
isTrigger
booleanfalseReports overlaps (OnTriggerEnter2D …) instead of colliding
Layer
layer
physics layer0Physics layer — Project Settings → Physics decides which layers collide
Offset X
offsetX
number0
Offset Y
offsetY
number0
Points
points
json[[-50,-50],[50,-50],[50,50],[-50,50]]Outline as [[x, y], …] in local pixels, in order (either winding); concave is fine, self-crossing is not

Material ​

FieldTypeDefaultDescription
Density
density
number (0 … ∞)1Mass per square metre — used when the Rigidbody2D has Use Auto Mass on
Friction
friction
number (0 … ∞)0.40 = ice; the two colliders' frictions combine (√(a·b))
Bounciness
bounciness
number (0 … 1)0Restitution: 0 = no bounce, 1 = keeps all its speed (the higher of the two wins)

© 2026 PlayAdGentic