Hi. I want to detect collisions between a drawn circle using the draw_arc command with my scene, consisting of polygon2Ds. I have this code:
#Todo: How to attach collision shape to a draw primitive
# Called when the node enters the scene tree for the first time.
var smaller: int = -1
if get_viewport().size.x <= get_viewport().size.y:
smaller = get_viewport().size.x
smaller = get_viewport().size.y
var radius = randi() % (smaller / 2)
var x = randi() % ((get_viewport().size.x as int)-radius)
var y = randi() % ((get_viewport().size.y as int)-radius)
var shape = CircleShape2D.new()
shape.radius = radius
var coll_shape = CollisionShape2D.new()
draw_arc(Vector2(x,y), radius, 0, 360, 1000, Color(1.0,0,0,1.0), 1)
Is it possible to somehow make a drawn primitive have a collisionshape? The script is associated with the root node.