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

[shapes] False positive with CheckCollisionPointPoly() #3742

Closed
4 tasks done
mllimo opened this issue Jan 20, 2024 · 1 comment
Closed
4 tasks done

[shapes] False positive with CheckCollisionPointPoly() #3742

mllimo opened this issue Jan 20, 2024 · 1 comment

Comments

@mllimo
Copy link
Contributor

mllimo commented Jan 20, 2024

Please, before submitting a new issue verify and check:

  • I tested it on latest raylib version from master branch
  • I checked there is no similar issue already reported
  • I checked the documentation on the wiki
  • My code has no errors or misuse of raylib

Issue description

The "CheckCollisionPointPoly" function gives me a false positive when I check that two instances of squares form by 4 vertices are colliding particulary when one vertex is inside the other. I have noticed that it happens only when I reach the same or lower "Y" coordinate from the right side or when I surround it in clockwise direction. See the videos below for more clarity.

Environment

Windows 11 x64, OpenGL 3.3, AMD Radeon RX 6600

Issue Screenshot

https://github.com/raysan5/raylib/assets/38075437/bce679e1-ada7-4467-b86b-4292ba58c5fe
debugging
verticesrepresentation

Code Example

int main()
{
    std::vector<Vector2> vertices_b = {
        { 668.678406, 60.9284592 },
        { 629.318420, 53.7983131 },
        { 622.188721, 93.1581116 },
        { 661.548462, 100.287857 }
    };
   
    // Colliding: 1 
    std::cout << "Colliding: " << CheckCollisionPointPoly({ 100, 100 }, (Vector2*)vertices_b.data(), vertices_b.size()) << '\n';
}
@raysan5
Copy link
Owner

raysan5 commented Jan 20, 2024

@mllimo thanks for reporting! CheckCollisionPointPoly() was a contributed function, let's see if someone could take a look to it.

@raysan5 raysan5 changed the title [raylib.h] False positive with CheckCollisionPointPoly [shapes] False positive with CheckCollisionPointPoly() Jan 20, 2024
@raysan5 raysan5 closed this as completed Jan 22, 2024
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