The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

+3 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 (685 points)

1 Answer

+5 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 (699 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.