Hello! I want to make a scene with a CollisionPolygon2D and a Polygon2D that are the same thing so the player can see what they can collide with. I know I can manually copy over the collision data for every single one, but that seems cumbersome and error-prone. Is there something silly I’m not seeing, like a way to give the CollisionPolygon2D a texture instead of having a separate Polygon2D for the texture?
You can copy over the polygon parameter from Polygon2D and paste it into the polygon parameter of the CollisionPolygon2D. You can automate it with a simple script, like this one:
extends CollisionPolygon2D
func _ready() -> void:
var polygon_2d: Polygon2D = get_node_or_null("../Polygon2D")
if polygon_2d:
polygon = polygon_2d.polygon
This will check if there is a Polygon2D sibling and if yes, copy over the polygon parameter.