I’m trying to rotate a 2d mesh arround a normal vector.
The goal is to get like an image who is perpendicular to a normal vector get by a hit on mesh. For example with a sphere, I need the image to be perpendicular to the hit point on the sphere.
So consider that I’m totally a beginner (even in JS ).
What I understand about decals it’s apply a texture on a 3d mesh and the texture will react like a tattoo, it will take the shape of the mesh. What I technically want is moving thanks the mouse a 2D mesh (literally a plane or a image) on the 3d mesh maybe as a moving decal (maybe moving decal is a more appropriate term) or juste like the first thing you explained to me just try to use normals to display the mesh perpendicularly to the sub faces.
Anyway thank you again for you help I just see that you solved my problem thank you very much really it helps me a lot to understand.
That’s incredible thank you very much!!! I will check everything and try to understand it thank you for you help really, if you are in Seoul or planning to come here tell me I owe you a beer!
Sorry to bother you again I’m trying to do the same for a GLTF file that I loaded with the loader but I’m totally lost , I don’t know how to get the meshes of the GLTF file. Do you have some clues?
In your PG https://www.babylonjs-playground.com/#WGZLGJ#646 the mesh on lines 36 and 37 is not assigned to anything. Put your pointer over the boombox and check the console in your browser for the error message.
Thank you Sebavan for you help, and thank you very much JohnK I will check everything you told me to check and I will dig deeper about the GLTF system.
Thank you both of you for your help and your time!
I’m trying to apply what you told me in this topic in a personnal project but it appears that It doesn’t work I don’t know why the “norm” is always equal to vector zero.
I can’t show you a PG but I tried to append to the scene a GTLF file and inside this one their is lot of meshes maybe it’s the problem ? Because in the “boombox” there is only one mesh.
The pickResult.pickMesh return the good mesh and same for the nth-facet but apparently the “getFacetNormal” always return a vector 0.
By the way I needed to rotate the meshes so I used a TransformNode to link every meshes into this parent and then rotate the parent. Maybe it affected the result I don’t really know.
Yeah sorry for the PG, I tried to get the same problem in a PG but I failed to get the same problem
And yeah that’s really weird that no normals are defined, so finally I just recreate the mesh in Blender and join every sub-meshes in one and it works well now but wanted to find why it doesn’t work in the other situation.