Skip to content
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

Hit Area Tool vertices and lines misaligned for containers #284

Closed
SolSearcher opened this issue May 20, 2023 · 3 comments
Closed

Hit Area Tool vertices and lines misaligned for containers #284

SolSearcher opened this issue May 20, 2023 · 3 comments

Comments

@SolSearcher
Copy link

  • Phaser Editor 2D Version: v3.61.0
  • Operating System: Windows 11
  • Web Browser and version: Chrome

Description

When adding a Hit Area to a container if the origin of the group isn't set at 0,0 the hit area vertices and lines are misaligned.
The misalignment happens most for the polygon shape but the origin of the hit area is unexpected even when using rectangles so I would assume the same root issue would apply

Screenshots

  1. Showing the origin of the container. It was set using the origin tool and is important for this particular project
    image

  2. Using the hit area polygon tool you can see how the vertices seem like they're in an okay location but the lines don't match up
    image

Reproduction Steps.

  1. Add two sprites to the scene and put them both in a container.
  2. Use the Origin tool on the container and make sure the origin isn't on the top left (0,0) corner of the group
  3. Add a polygon hit area shape
  4. Use the new hit area tool and you should see the vertices and lines are now misaligned

Possible solution

Account for group origin when drawing the lines and vertices in the editor.
Workaround for now after testing is knowing that the lines are accurately representing the hit area and the vertices are not in the correct location

Ideally the original instantiation of the hit area should be based on the container origin and scale since creating the hit area for a container has strange behavior when starting and is often too small and off center

Thanks for looking at this. The new tool is amazing and this seems like a pretty edge case scenario

@PhaserEditor2D
Copy link
Owner

I can reproduce it, thanks!

By the way, the container object is always at 0,0. The editor does a trick with the origin tool for moving around the children so it simulates a change in the origin.

I will work on this issue.

@PhaserEditor2D
Copy link
Owner

Fixed.
Screenshot 6

@PhaserEditor2D
Copy link
Owner

I also fixed the initial values for the hit area of polygons and the other shapes:

Screenshot 5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants