+2 votes

Hi,

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... :)

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

Thank you!

in Engine by (674 points)

1 Answer

+4 votes
Best answer

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

get_polygon() 

and set the array on the CollisionPolygon2D with

set_polygon()
by (693 points)
selected by

Perfect, thank you!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.