Polygon2D coordinates to CollisionPolygon2D

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By bruteforce
:warning: Old Version Published before Godot 3 was released.


I am a beginner, and sorry for my English :)!

I use textured Polygon2D and CollisionPolygon2D (inside a StaticBody2D) to build platforms.
When I’m done with a Polygon2D, I need to specify exactly the same coordinates for the CollisionPolygon2D one by one.
There is a lot of platform with a lot of coordinates, so this is quite boring… :slight_smile:

Is there any way to do this simultaneously, or a method to copy the coordinates from the Polygon2D to the CollisionPolygon2D?

Thank you!

:bust_in_silhouette: Reply From: puppetmaster-

By hand you can do this…
enter image description here
and then this…
enter image description here
to copy and past your coordinates.

With gdscript you can get the vector2Array from the Polygon2D with


and set the array on the CollisionPolygon2D with


Perfect, thank you!

bruteforce | 2016-12-06 18:21