I would like to scale a cube and keep the texture the same size (tile or scale texture) need this to work with all 6 sides or x,y,z sides is there an example link or maybe I am missing something that already works that I have missed.
Just scale your texture in the same way than your mesh:
this only works if the cube is square and not rectangular?? is there a way to scale the texture independently from each side so the scale on each X, Y, Z can be irregular?
The same texture is used for each side of the mesh, and because the uScale/vScale are properties of the texture, you can’t make different scales for each side of the mesh.
If you want to do that, you will either have to split your cube into planes and set a different texture to each plane, or change the uv coordinates of each face of the cube in a creative way to achieve what you want.
Is there a way to know which face associated with X, Y, or Z?
And when you say " and because the uScale/vScale are properties of the texture" but is still confined to the mesh and not the material? So each cube could have its own scaling and the texture can be scaled independently and still share the same material on multiple meshes?
I don’t really understand this…
If you mean finding the face that has a normal like (1,0,0), (-1,0,0), (0,1,0) and so on, then it’s not an information directly available. However, if you are using
CreateBox, those are always created the same way, so it should be possible to know…
As in the creation code there is:
var normals = [ 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0];
I would say:
- face 1 has normal (0,0,1)
- face 2 has normal (0,0,-1)
- face 3 has normal (1,0,0)
- face 4 has normal (-1,0,0)
- face 5 has normal (0,1,0)
- face 6 has normal (0,-1,0)
No, the texture is bound to a material: if you reuse the same texture for multiple materials, you will get the same uScale/vScale for this texture in those materials. If you want different texture scaling, just clone the texture and change the scaling.
how do I get to faceUV
example of getting to uScale . current_obj.material.diffuseTexture.uScale ?? how do I get or change the faceUV?
Try to look for faceUV in the forum.
Thanks for all your help…
Everything I have found is something to accomplish when you create the mesh not if a mesh already is in the scene.
I was planning on using the scale gizmo.