-
-
Notifications
You must be signed in to change notification settings - Fork 484
Fix marker screen detection and click events (#2029 & #1853) #4375
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
base: master
Are you sure you want to change the base?
Fix marker screen detection and click events (#2029 & #1853) #4375
Conversation
Co-authored-by: Nico <[email protected]>
There's no sign of the |
Thanks , also |
26e7235
to
74cbc2b
Compare
9d86c52
to
5abe1e6
Compare
(#2029 & #1853)
Statement
Markers are not traditional GTA objects and don't integrate with the game's native collision system. Several approaches were evaluated, but integrating markers with onClientClick caused issues due to the fundamental difference between markers and world objects.
Why?
We couldn't use onClientClick for markers because if there's a world object behind a marker, the object would be detected with higher priority than the marker due to GTA's native collision system. Markers aren't like other world objects, they're client-side UI elements that don't participate in the game's standard collision detection, requiring a separate detection approach.
Solution
Implemented a specialized marker detection system, enhanced screen visibility detection (IsClientSideOnScreen) with proper viewport clipping, and a new
onClientMarkerClick
event with parameters (button, state, screenX, screenY, worldX, worldY, worldZ, distance).Result :
Notes: I also found that click detection isn’t perfectly equivalent to marker size or shape (tested with arrow type only). This might be fixed by someone else in another PR, since it’s the original behavior and not related to my edits. I could add a threshold to the detection, but I preferred to leave it as is for now.
Feedback is appreciated 👍🏻
Example Usage :