Is there a getTextureCoordinates method that does not require pickWithRay?

I’ve been successfully using the standard example in the Babylon JS documentation:

var pickingInfo = scene.pickWithRay(ray, function (currentMesh) {
    return meshTask.loadedMeshes.find(x => currentMesh);

Then once I have my pickingInfo, i use it to getTextureCoordinates for the corresponding picked point, but was curious if there was an existing method that would allow me to provide my own mesh and point as a parameter without using the pickWithRay?

Thank you,

hi. you can get mesh from scene e.g. by name and provide your coordinates as Vector 3. other question where you get coordinates in local space of texture…

Right, I know I can use scene.getMeshByName and I know how to make a Vector3. What I want to be able to do is something like:

var setMeshInfo = scene.setPointOnMeshForTextureCoords(mesh, point);
var textureCoords = setMeshInfo.getTextureCoordinates();

something like that. Is this possible? I know I can hijack the return values of a scene.pickWithRay… I tried it and it worked, but i know that’s not what its for and would rather do things properly if the method exists.


You need to use the picking info because we need to understand where on the triangle the point is (we need the distance from the triangle vertices to evaluate the correct uv)

1 Like

what are you trying to do?

I understand, thank you everyone for your time