Gugis Posted July 11, 2014 Share Posted July 11, 2014 Does PickingInfo object returns uv coordinates of picked point? I thought properties bu and bv is uv coordinates, but it doesn't seems like it. I need this for terrain texturing tool I'm making. Maybe you guys have any ideas? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 13, 2014 Share Posted July 13, 2014 I've just added a new function to PickingInfo: pickInfo.getTextureCoordinates() JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
Gugis Posted June 15, 2015 Author Share Posted June 15, 2015 I've just added a new function to PickingInfo: pickInfo.getTextureCoordinates()As i understand these coordinates are relative to each triangle. But how does it helps getting real coordinates on texture? Quote Link to comment Share on other sites More sharing options...
RaananW Posted June 15, 2015 Share Posted June 15, 2015 Wow, took you a while to answer :-) Those are the UV coordinates of the picked point. With those two values you can find the relative position on the image set as texture. It is a number between 0 and 1 which corresponds to the width/height of the image in the same way percentage corresponds to it - 0 is 0 % of the width or height, 1 is 100% of the width or height. So, if you have those texture coordinates : (0.4 , 0.5) and the texture is 200x200, the position on the image would be (80, 100). You can read more about UV mapping here - https://en.wikipedia.org/wiki/UV_mapping JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
Gugis Posted June 15, 2015 Author Share Posted June 15, 2015 Wow, took you a while to answer :-) Those are the UV coordinates of the picked point. With those two values you can find the relative position on the image set as texture. It is a number between 0 and 1 which corresponds to the width/height of the image in the same way percentage corresponds to it - 0 is 0 % of the width or height, 1 is 100% of the width or height. So, if you have those texture coordinates : (0.4 , 0.5) and the texture is 200x200, the position on the image would be (80, 100). You can read more about UV mapping here - https://en.wikipedia.org/wiki/UV_mappingNope, those are coordinates of point in triangle. Quote Link to comment Share on other sites More sharing options...
Gugis Posted June 16, 2015 Author Share Posted June 16, 2015 There's example you can see how these coordinates works http://www.babylonjs-playground.com/#DBFVA#1Click anywhere on plane and check for coordinates in console. You can see that coordinates are relative not to whole mesh but each triangle. Quote Link to comment Share on other sites More sharing options...
Temechon Posted June 16, 2015 Share Posted June 16, 2015 I tried your example, but each coordinate is relative to the whole mesh... Quote Link to comment Share on other sites More sharing options...
Gugis Posted June 16, 2015 Author Share Posted June 16, 2015 I tried your example, but each coordinate is relative to the whole mesh... Here's how i get coordinates Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.