Skip to content

Add ProcessLineAgainstMesh #3178

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

Merged
merged 6 commits into from
Sep 19, 2023

Conversation

Pirulax
Copy link
Contributor

@Pirulax Pirulax commented Sep 8, 2023

This PR adds a new function ProcessLineAgainstMesh, that is supposed to do a raycast against an element's renderable mesh model [not the collision model!].
The same functionality is already present in #3099, but the latter is a little buggy due to the fact that the collision model is always simplified, and not exactly the same as the mesh, and this leads to situations where no hit is detected, even though the visible mesh is hittable.
Also, when one is interested in a specific element the overhead is a lot smaller [as we can skip all the collision detection done by processLineOfSight]
The reason I didn't make it be a standalone function in the beginning is that not all game entitites can be represented as CClientEntity [For example IPL objects].

float u, float v, string textureName, string frameName, float hitX, float hitY, float hitZ = processLineAgainstMesh(Element targetElement, float startX, float startY, startZ, float endX, float endY, float endZ)

@CrosRoad95
Copy link

does it take an account animated models like 3425? i expect that when i use this function the results will match what i see. also, does it work for peds and vehicles?

@Pirulax
Copy link
Contributor Author

Pirulax commented Sep 9, 2023

No clue, haven't tried.
It does work for vehicles, and I guess it should work for peds too.
afaik animations don't affect the geometry directly, but only what is rendered, so the answer is no I believe

@Pirulax
Copy link
Contributor Author

Pirulax commented Sep 17, 2023

I've applied the requested suggestions.

@Pirulax Pirulax requested a review from botder September 17, 2023 22:11
@botder botder merged commit acb80a3 into multitheftauto:master Sep 19, 2023
@botder botder added the enhancement New feature or request label Sep 19, 2023
@botder botder added this to the 1.6.1 milestone Sep 19, 2023
MTABot pushed a commit that referenced this pull request Sep 19, 2023
acb80a3 Add function processLineAgainstMesh (PR #3178)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants