Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

Raycast to texture coord (or: 3d point to texture coord)?

$
0
0

@GeonBit wrote:

Hi all,

Anyone got a tutorial or knows how to convert a 3d position to the 2d texture coord on a quad (assume the vector is on quad).

Basically what I want to do is this:

See the cursor pointing on the wall on the left? I know how to do ray casting from camera and cursor and get the exact 3d point on the wall I point on, but how do I then convert that position to the 2d position on the texture on the right?

To make things easy - its all just simple quads with UV of 0, 0, 1, 1, no special mapping or atlas.

EDIT: this explains best what I want to do: https://docs.unity3d.com/ScriptReference/RaycastHit-textureCoord.html

Thanks!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles