How to map the UV coordinate to the actual coordinate in the image

Hi, i’m trying to put the image where the user click on the dynamic texture. I want the center of the image to be where the user clicks. So far i’ve done this.

But i’m not able to get the actual coordinates of the texture from the UV coordinates. How can i do this??

Hi there!

I think what you’re looking for is getTextureCoordinates().

bu and bv are barycentric UV coordinates, which are used by getTextureCoordinates() to calculate the texture coordinates we want.

Here’s an updated playground. Also note that the mapping from v to y is different than u to x :open_mouth:

3 Likes

Thank you so much @alexhuber.