-
Notifications
You must be signed in to change notification settings - Fork 491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ellipse random() is incorrect #522
Comments
random() didn't return a point anywhere in the Ellipse area. Full details and screenshots (before & after) can be found on phaserjs/phaser-ce#522 assuming the issue is the same in Phaser 3.
Test code - https://codepen.io/budda/pen/jzdboZ |
Comment from @photonstorm phaserjs/phaser#3534 (comment)
|
The confusion is because the arguments are different:
Nonetheless the points returned by Ellipse#random seem to be placed incorrectly. They are centered on (x, y), but they should be centered on (x + width / 2, y + y / 2). https://codepen.io/samme/pen/ZxwMMN. Phaser.Utils.Debug#geom seems to have the same problem. |
Okay, new test random code sorts out the random points - https://codepen.io/budda/pen/KoJOXB I'm not familiar with the geom debug stuff, I presume it's something wrong on the line
But i'm not sure what this is doing with the camera stuff? |
Also, inline documentation needs correcting as its not halfWidth & halfHeight that should be passed in. Current, incorrect in Graphics.js ...
Because I believe, the width & height is then divided in half on our behalf in the function:
|
The descriptions are correct. They should probably be renamed as |
But that would suggest that the final X & Y coord is a quarter as it divides the width again inside the method? My head is mangled following this Ellipse lark now! |
Divides the width again inside which method? |
Phaser.Graphics.prototype.drawEllipse |
This Issue is about
Phaser version(s): 2.10.3
What should happen: points returned up to the circumference of the defined ellipse
What happens instead: points returned in the centre with a large padding around ellipse edge.
The text was updated successfully, but these errors were encountered: