Godot Version
4.3
Question
I’ve transformed a sprite2D into a polygon2D using bitmap conversion. I intend to slice the polygon2D and only show certain points (i.e. a section of the polygon) relevant on the screen. When testing, I was able to slice at certain indexes and was able to view on the screen, however at other indexes I could not. Could anyone help explain why?
For example,
Displays on screen with 11 points
var slice = polygons[i].slice(0,11)
[(117, 31), (110, 31), (110, 32), (105, 32), (105, 33), (101, 33), (101, 34), (98, 34), (98, 35), (95, 35), (95, 36)]
Does not display on screen with 10 points
var slice = polygons[i].slice(0,10)
[(117, 31), (110, 31), (110, 32), (105, 32), (105, 33), (101, 33), (101, 34), (98, 34), (98, 35), (95, 35)]
var polygon: Polygon2D = Polygon2D.new()
print(polygons[i].size()) # size of 452
var slice = polygons[i].slice(0,11)
print(slice)
#slice.sort()
polygon.polygon = slice
polygon.texture = texture
polygon.uv = slice
Original sprite
slice size 11 is displaying - not a great example but wanted to show coordinates
Larger slice (size 101) which renders but 100 does not
Thanks!