ShadowRanger24 50 Posted July 5, 2017 So someone on Discord showed me how to generate points around a circle based on a given amount and center position. However it has an issue, for some reason the first and last position in every returned array is the same. I can't seem to figure out why. Here's the script: params [ ["_amount", 0, [0]], ["_origin", [], [[]]], ["_radius", 0, [0]] ]; private _positions = []; for "_a" from 0 to 360 step (360 / (_amount - 1)) do { _positions pushBack (_origin getPos [_radius, _a]); }; _positions Thanks in advance. Share this post Link to post Share on other sites
Grumpy Old Man 3549 Posted July 5, 2017 Getting positions for direction 0 and 360 will result in the same position. Not really that hard to figure out. Cheers 2 Share this post Link to post Share on other sites
ShadowRanger24 50 Posted July 5, 2017 5 minutes ago, Grumpy Old Man said: Getting positions for direction 0 and 360 will result in the same position. Not really that hard to figure out. Cheers Yeah got it sorted, wasn't thinking properly. Cheers tho. For anyone curious to what needed to be changed for it to work: params [ ["_amount", 0, [0]], ["_origin", [], [[]]], ["_radius", 0, [0]] ]; private _positions = []; for "_a" from 0 to 359 step (360 / _amount) do { _positions pushBack (_origin getPos [_radius, _a]); }; _positions Share this post Link to post Share on other sites
sarogahtyp 1109 Posted July 5, 2017 what about using step to get rid of the last element? if someone likes to get many points and step is smaller than one degree then u get a gap between 359 and 360. params [ ["_amount", 0, [0]], ["_origin", [], [[]]], ["_radius", 0, [0]] ]; private _positions = []; _step = (360 / _amount); for "_a" from 0 to (360 - _step) step _step do { _positions pushBack (_origin getPos [_radius, _a]); }; _positions Share this post Link to post Share on other sites