Godot Version
4.2.1
I randomly stumbled across this, not really sure what it is, but it says it wants to be reported so…
The error name is in the title, aditional information woud be this:
Basically, I am trying to create a circle that has a certain number of colors and the arcs of each color are equal
The line on which it stopped is this one:
“polygon = all_points”
The script for the scene:
extends Polygon2D
var all_points = PackedVector2Array()
func create(full_angle:float , nr_nodes:int , radius:int):
all_points.append(get_coordinates(0,radius))
for point in range(1,nr_nodes-1):
var angle = float(point * full_angle)/(nr_nodes-1)
var coords = get_coordinates(angle,radius)
all_points.append(coords)
all_points.append(get_coordinates(full_angle,radius))
all_points.append(Vector2(0,0))
polygon = all_points
func get_coordinates(angle, radius):
var cords:Vector2
cords.x = radius * cos(angle)
cords.y = radius * sin(angle)
return cords
The function create is called by another scene:
extends Node2D
var colors = [Color.AQUA,Color.BLUE,Color.RED,Color.AQUA,Color.BLUE,Color.RED]
var RADIUS = 30
var PRECISION = 10
var white_circle_radius = RADIUS * 2.2/4
var polygon_inst = preload(“res://pi_slice.tscn”)
func _ready():
for i in range(1,colors.size()+1):
await get_tree().create_timer(0.4).timeout
var poligon = polygon_inst.instantiate()
add_child(poligon)
poligon.create(2PI/colors.size(),PRECISION, RADIUS)
poligon.rotation = -float(2PIi)/colors.size()
poligon.color = colors[i-1]
#make_white_circle
await get_tree().create_timer(0.1).timeout
var poligon = polygon_inst.instantiate()
add_child(poligon)
poligon.color = Color.WHITE
poligon.create(2PI,PRECISION*10, white_circle_radius)
func choose_color(poz:Vector2):
var angle = atan2(-poz.y,poz.x)
if angle<0:
angle += PI
var angle_per_color = (2*PI / colors.size())
var color = colors[angle/angle_per_color]
return color
Not sure if all of this helps, or if it’s the right site, as most errors are usually placed on github, but I just don’t know the best place to post this (or if it even matters anymore as this version is a bit older).
