How to attach a collisionshape to a draw primitive?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By CGAdventurer

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

extends Node2D

# Called when the node enters the scene tree for the first time.
func _ready():

func _draw():
	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 =
	shape.radius = radius
	var coll_shape =
	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.

Isn’t this the same question as:

How to add a collisionshape (shape: CircleShape2D) to a draw primitive? - Archive - Godot Forum

If so, you’ll get more assistance by keeping everything in a single question…

jgodfrey | 2020-02-15 16:34

Yeah it is the same.

I thought i did not post the thread as it did not show up in my questions. It just took some time to get approved.

Appologies for the duplication.

CGAdventurer | 2020-02-15 19:19