-
Notifications
You must be signed in to change notification settings - Fork 325
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
get_sprites_at_point broken #2253
Comments
Poke if you run out of time on this one. |
When mouse intersects with the horizontal edges of the hitbox the selection goes crazy including everything to the right. import arcade
from arcade import SpriteList, Sprite, SpriteSolidColor
class MyGame(arcade.Window):
def __init__(self):
super().__init__()
self.spritelist: SpriteList[Sprite] = arcade.SpriteList()
for y in range(8):
for x in range(12):
sprite = SpriteSolidColor(100, 100, color=arcade.color.WHITE)
sprite.position = x * 101 + 50, y * 101 + 50
self.spritelist.append(sprite)
self.sprite_cursor = arcade.SpriteSolidColor(100, 100, color=arcade.color.WHITE)
self.pos = 0, 0
def on_draw(self):
self.clear()
# Reset color
for sprite in self.spritelist:
sprite.color = arcade.color.WHITE
# sprite.angle += 0.2
# Mark hits
x, y = self.mouse["x"], self.mouse["y"]
print(x, y)
hits = arcade.get_sprites_at_point((self.mouse["x"], self.mouse["y"]), self.spritelist)
for hit in hits:
hit.color = arcade.color.RED
self.spritelist.draw()
self.spritelist.draw_hit_boxes(color=arcade.color.GREEN)
MyGame().run() |
from @pushfoo TL;DR: It's still happening, and it isn't just big sprites One of our users appears to have run into this on Discord today. Their sprite tiles appear to be 48x48 and the hitbox appears to be clean. See the video below (Converted with 777777.mp4 |
Use |
When a point intersects a line in the hitbox you get false positives.
EDIT: Changes are already in
point-in-polygon-fix
branch. Unit tests for the geometry module have been broken up. They needs a bit of extending.The text was updated successfully, but these errors were encountered: