teststrecke-game/scripts/line_2d_collision.gd

15 lines
273 B
GDScript3
Raw Permalink Normal View History

2024-12-04 15:30:43 +00:00
extends Line2D
func _ready() -> void:
var staticbody:StaticBody2D=get_child(0)
$".".visible=false
var line_poly=Geometry2D.offset_polyline(points,width/2)
for poly in line_poly:
var col = CollisionPolygon2D.new()
col.polygon=poly
staticbody.add_child(col)