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

Use some sort of ray collision detection #6

Open
catmanjan opened this issue Nov 5, 2014 · 2 comments
Open

Use some sort of ray collision detection #6

catmanjan opened this issue Nov 5, 2014 · 2 comments

Comments

@catmanjan
Copy link

The problem with rectangle collisions is that they tend to appear to pass through objects, this is more obvious with debug turned on, but even with it off it gives a sense of oddness.

If instead of projecting a box ahead of the mouse velocity, a line was marched in that direction (ala raycasting) I think the experience would be improved.

@cihadturhan
Copy link
Owner

Hi @catmanjan, thanks for the idea. I actually thought about this and I'm agree with the issue rectangle passing through. I'm thinking about smarter algorithms instead of direct proportion between speed and rectangle size. However, if we use raycasting we will have two issues:

  • What if two buttons are in the same direction the ray points to? Which one will be chosen? Will the ray choose both of the buttons or the first one it collides?
  • Currently, rectangle-rectangle intersection returns a value (not true or false) so I can understand how much they intersect. If it's equal to 1.0 then they intersect fully or if it's 0.1 they intersect slightly. I'm not sure if raycasting will give similar opportunity.

Considering these two, I'm reluctant to change the current implementation but I'm open to new opinions.

@sheerun
Copy link

sheerun commented Nov 5, 2014

What if two buttons are in the same direction the ray points to? Which one will be chosen?

Neither

Also there's issue when my cursor is on button and leaves it. Your plugin recognizes it as cursor entering button and clicks it (it's visible in permanent-down dropdown demo).

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

3 participants