Created
October 31, 2016 16:37
-
-
Save Giacom/2054770f43b1467cbbd4047ab27b40df to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var polygon = child.get_polygon() # Replace with the new vector2array that you want to set | |
| var polygonShape = ConcavePolygonShape2D.new() | |
| var segments = Array() | |
| segments.resize(polygon.size() * 2) | |
| for i in range(polygon.size()): | |
| segments[(i << 1) + 0] = polygon[i] | |
| segments[(i << 1) + 1] = polygon[(i + 1) % polygon.size()] | |
| polygonShape.set_segments(segments) | |
| add_shape(polygonShape) # Probably will want to replace with set_shape instead |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment