Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×

Issue With Walls Drawn by API Script

1488598380
Timothy M.
Pro
API Scripter
Hello, I wanted to make it easier to build maps with things like trees and other round/elliptical objects, so I wrote a script today that allows the GM to draw a circle on the dynamic lighting layer and have it automatically replaced by a polygon approximation of a circle instead. The drawing works correctly-- or at least, the new polygon appears in the correct location and the circle is deleted. When I use a character to check it, however, the actually area that's blocked is offset by the diameter of the circle, always in the same direction. Any ideas what could be behind this?
1488601627
Lithl
Pro
Sheet Author
API Scripter
Could you share the code that's creating the polygon?
1488603532
Timothy M.
Pro
API Scripter
Looking back over the code, I found the issue: at each step I was computing a y coordinate based on the radius, y = -radius + radius*cos(angle). Flipping it to y = radius + radius*cos(angle) solved the problem!