How to get a face of a mesh with mouse click
Asked Answered
P

3

0

Any help?

Partlet answered 6/3, 2021 at 19:55 Comment(0)
S
0
This discussion was caught in the moderation queue since you have not confirmed your account yet.
Upon creating your account you should have received an account verification email. The confirmation email may have been incorrectly flagged as spam, so please also check your spam filter. Without confirming your account, future posts may also be caught in the moderation queue. You can resend a confirmation email when you log into your account if you cannot find the first verification email.
If you need any help, please let us know! You can find ways to contact forum staff on the Contact page. Thanks! :smile:
Stillhunt answered 6/3, 2021 at 19:58 Comment(0)
S
0

You can use MeshDataTool to get all the faces, then loop trough them and calculate if mouse is inside the triangle. Here's a demo code: https://github.com/TassuP/GodotStuff/blob/master/TexturePainterDemo/DrawToTexture.gd

Soucy answered 18/2, 2022 at 5:45 Comment(0)
R
0

What is it you need? You can get the normal fairly easily with a ray cast. This will give you a normal and a position value. To get the actual face (the 3 vertices) I think you need MeshDataTool as @TassuP suggests, but it is rather slow for real time (it can work if you do it only on load though).

Relic answered 18/2, 2022 at 7:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.