Is there a way to create texture from CollisionPolygon2D?

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

I try to make a global strategy game with weird-shaped provinces as Paradox has. So I want to lite up an area if I hover the cursor on it.

:bust_in_silhouette: Reply From: kidscancode

Your CollisionPolygon2D has a polygon property. You can use that value to

  1. Assign the polygon property of a Polygon2D


  1. Pass to draw_polygon()

$Polygon2D.polygon = $StaticBody2D/CollisionPolygon2D.polygon

fhgaha | 2021-05-21 14:42