Description
Changelog
Reviews (0)

Curve2Collision turns a Path2D curve into a thickened CollisionPolygon2D, and keeps it in sync automatically while you edit the curve. Useful for slopes, tubes, rails, cave walls — anything you would rather draw as a line than build vertex by vertex.

Usage

  1. Add a StaticBody2D (or AnimatableBody2D for moving platforms, Area2D for detection only) to your scene.
  2. Add a CurveCollision2D node as its child. CollisionPolygon2D only works as a direct child of a CollisionObject2D, so this parenting matters — the node shows a configuration warning if it is placed anywhere else.
  3. Draw the curve as usual with the curve editing tools.
  4. Set thickness. A CollisionPolygon2D named GeneratedCollision is created and updated automatically.
StaticBody2D
├── CurveCollision2D      <- you draw the curve here
└── GeneratedCollision    <- generated CollisionPolygon2D

Properties

Property Type Default Description
thickness float 32.0 Width of the band. Stays constant along the whole curve.
closed_loop bool false Joins the start and end into a closed ring shape.
tolerance_degrees float 4.0 Curve tessellation accuracy. Lower is smoother but adds vertices.
max_vertices int 120 Cap on the centreline vertex count, for performance.
join_type enum Round Corner style: Round / Square / Miter.
end_type enum Round Cap style: Round / Square / Butt. Ignored when closed_loop is on.
auto_update bool true Regenerate on every curve edit. Turn off for heavy curves.
regenerate_now bool false Manual regeneration trigger.

Self-intersection

Shapes are built with Godot's own Geometry2D.offset_polyline() / offset_polygon() (Clipper). Even when the thickness is large relative to a tight curve, the self-intersections that appear on the inner side are resolved correctly by the library — the band never pinches or distorts.

With closed_loop enabled, the outer and inner contours are offset separately and stitched into a ring. If the thickness is large enough that the inner contour disappears, the result becomes a solid blob.

Known limitations

  • join_type = Round produces smooth corners at the cost of more vertices. Use Miter or Square, or tune tolerance_degrees / max_vertices, if you need it lighter.
  • Rectangle and circle frame shapes are not supported — curve-based shapes only.
  • Auto-updating many curves at once can slow the editor down. Turn off auto_update and use regenerate_now manually in that case.

Requirements

Godot 4.x. Tested on 4.7.1.

MIT licensed. Source and issues: https://github.com/seina369/godot-curve2collision

Changelog for version v1.0.0

No changelog provided for this version.

Reviews

Curve2Collision has no reviews yet.

Login to write a review.

Consider supporting the creators!

If you enjoyed this asset consider supporting its creator. Follow the link below.