Topic was automatically imported from the old Question2Answer platform.
Asked By
BFGames
Old Version
Published before Godot 3 was released.
Hi,
I’m trying to change the shape of a collision polygon within the script, but I don’t know how to set up a Vector2Array. I’ve had a look at the documentation, and the only parameter says Array from and I don’t know where to begin without seeing an example usage.
Can anyone point me to an example or resource to use as a guide?
It can also be created from a dynamic array, like the doc said shows:
var a = Vector2Array([ Vector2(1,1), Vector2(2, 2), Vector2(3,3) ])
Note: in Godot 3.0 Vector2Array has been renamed PoolVector2Array.
I think it’s a great point - from a relative newbie’s perspective, having examples of the constructors would save no end of time - i’ve never encountered a Vector2Array in my limited experience and had no idea of the correct syntax. Never mind!
I’d attempted something like the dynamic array approach, but foolishly forgot the square brackets. Still not progressed to 3.0 yet, but thanks for the heads-up.