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

Using ray casting to select faces #684

Closed
LeonardMeagher2 opened this issue Sep 9, 2014 · 12 comments
Closed

Using ray casting to select faces #684

LeonardMeagher2 opened this issue Sep 9, 2014 · 12 comments

Comments

@LeonardMeagher2
Copy link
Contributor

http://www.moczys.com/webGL/Experiment_02_V05.html

Being able to select a face from a mesh, or collision shape could be a useful feature in godot, in this example they change face color, but I could imagine using the face to get uv information which can turn to pixel information, and having the ability to move an image around in a 2d scene.

@TheoXD
Copy link
Contributor

TheoXD commented Sep 9, 2014

Use MeshDataTool to read faces and their vertices, and for each face run
var intersects = Geometry.ray_intersects_triangle( Vector3 from, Vector3 dir, Vector3 a, Vector3 b, Vector3 c )
and if you want the intersection point you create var plane = Plane(Vector3 a, Vector3 b, Vector3 c)
and check for the intersection point var co = plane.intersects_ray( Vector3 from, Vector3 dir )

@LeonardMeagher2
Copy link
Contributor Author

so Geometry.ray_intersects_triangle is a Boolean, and plane.intersects_ray, is a Vector3?

@reduz
Copy link
Member

reduz commented Sep 9, 2014

The problem is that, on release, this information is not available, as not
stored in the server.

I was thinking of creating a node that holds geometry information in an
efficient way to allow for this kind of stuff, such as queries and
real-time decals.

On Tue, Sep 9, 2014 at 8:22 PM, Leonard Meagher notifications@github.com
wrote:

so Geometry.ray_intersects_triangle is a Boolean, and
plane.intersects_ray, is a Vector3?


Reply to this email directly or view it on GitHub
#684 (comment).

@LeonardMeagher2
Copy link
Contributor Author

I like the sound of that haha.
@reduz

@akien-mga akien-mga changed the title [Feature Request] Using ray casting to select faces Using ray casting to select faces Oct 30, 2015
@bojidar-bg
Copy link
Contributor

Shouldn't this be considered for 3.0?

@bojidar-bg bojidar-bg added this to the 3.0 milestone Dec 29, 2016
@akien-mga
Copy link
Member

What's the status on this for the upcoming 3.0 release?

@reduz
Copy link
Member

reduz commented Aug 4, 2017

There is TriangleMesh now, but it does not keep UV information. It's also mostly used for editing.
Kicking for 3.1

@reduz reduz modified the milestones: 3.1, 3.0 Aug 4, 2017
@akien-mga
Copy link
Member

Moving to the next milestone as 3.1 is now feature frozen.

@akien-mga akien-mga modified the milestones: 3.1, 3.2 Sep 15, 2018
@LeonardMeagher2
Copy link
Contributor Author

I don't think this a necessary feature anymore, it's easily solved many other ways.
Might open another issue or PR for exposing TriangleMesh functions to GDScript, but that's about it.

@idchlife
Copy link

idchlife commented Jun 8, 2021

So basically as of 2021 there is no built-in way as in Unity (RayCastHit.textureCoord) to get coordinate of texture to work with it etc?

I mean there are workarounds like shaders or manually iterating through every vertice but no easy way?

Asking because I came from Unity at some point and was utilizing .textureCoord heavily there. It seems Godot simply does not have such feature without modifying engine with some cpp plugins etc?

@leiget
Copy link

leiget commented Jun 13, 2021

@idchlife
Yes it seems so, unfortunately. But Considering the 4.0 render API refactor, I imagine it'll eventually be on the list. Let's see if there is a issue/request for it in the tracker, and if not, then maybe we should make one.

@Calinou
Copy link
Member

Calinou commented Jun 16, 2021

For the record, @leiget opened a proposal: godotengine/godot-proposals#2863

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants