-
-
Notifications
You must be signed in to change notification settings - Fork 93
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
Unable to get indices of raycast hit on indexed mesh where multiple triangles start on same index. #113
Comments
I found this PR + proposed solution but it's not working for my mesh where both vertices start with the same index. If I use Here's the index field for reference, the mesh is a simple rectangle generated through
Let me know thoughts on solution and if you want me to PR :) |
Maybe I'm just too dense but I'm still struggling with the same issue.
|
Description
When raycasting against and indexed mesh I am unable to differentiate between two vertices when both vertices start at the same index.
I'm trying to use
triangle_index
to lookup some attribute data but it looks like, for indexed meshes,triangle_index
contains the index after its already been mapped meaning I can't derive the index of the other verts in the tri.Extra, problem specific, details in case the context is helpful.
The second log is my (incorrectly) derived indices to lookup the attribute with.
The final log is my attempt at calculating the position attribute at the hit location using my (incorrectly) derived indices, the position attribute buffer and the barycentric coordinates. It should be equal to the
Hit 1 (Top Left):
Hit 2 (Bottom Right):
Solution?
Not 100% certain but it seems like the solution is we'll need to return all 3 triangle indices as
[usize; 3]
, growing the struct by 2usize
. I'm happy to PR if this is suitable but I worry I might be missing something as well. Can you let me know your thoughts? And thank you for maintaining this great library :)The text was updated successfully, but these errors were encountered: