Pryme8 Posted July 17, 2018 Share Posted July 17, 2018 https://www.babylonjs-playground.com/#NAG06Y#5 Ok, so I have my star shape which has all the vertices labeled, as you can see its UV is all sorts of messy. What I am trying to do is figure out a simple way to get its UV to match the plane that is the "same size". I know I can do it mathematically by the points points position in relation to the stars size and manually update the uv buffer. Just wondering if anyone has a quick and easy trick otherwise. I was thinking of writing up a "project UV plane" function, where you pass in a mesh, a plane and a vector3 to signify the projection direction. So like if the projection axis was Vector3(0,0,1) it would fire rays in this direction (and its inverse) from each of the target meshes vertices and check for a hit on the plane if it hits the plane update that points UV to match the raypicked point's uv. Is this gibberish or anyone savvy? Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted July 17, 2018 Author Share Posted July 17, 2018 Never mind got it... Unless someone else already has a more robust method. https://www.babylonjs-playground.com/#NAG06Y#6 https://www.babylonjs-playground.com/#NAG06Y#8 <- Non flat projection. https://www.babylonjs-playground.com/#NAG06Y#18 <- one with skipTo and stopAt for vertices ID in case you only want to project a section of a mesh. brianzinn 1 Quote Link to comment Share on other sites More sharing options...
Guest Posted July 17, 2018 Share Posted July 17, 2018 Love auto-solved topics ;D Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted July 18, 2018 Author Share Posted July 18, 2018 I was kinda thinking about making this a BABYLON.Mesh.projectMeshUV method or something. Could see others having a use for this, but I'm not sure if I have the time to debug and dev it to a full method... so Ill hold off and maybe write a snippet instead. 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.