Jump to content

cube face texture rotation


Recommended Posts

nothing prevent texture load.

I juste need to be able to "turn" 2 faces texture


pour comprendre:

mon objectif est de charger une texture sur mon cube (en script) pour pouvoir intégrer la texture que je souhaite. (pas de soucis c'est facaile)

Ensuite, tourner une face sur 2 de 90° pour rendre cela plus joli et "aligné". (là je sèche) exemple si je charge une texture briques. D'avoir des briques horizontales.


Link to comment
Share on other sites

Not sure you can rotate a texture for 90°...

You can easily flip if vertically or horizontally (so for 180°) with faceUV : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors#textures

If you want to change the way the texture is applied onto a box face, I'm afraid you need to modify the vertexData uvs to change their orientation.

Link to comment
Share on other sites

another simple lead (no time to make a PG, sorry) :

  1. create an updatable box
  2. get its uvs with box.getVerticesData(UV.Kind);
  3. swap the uvs on the wanted faces : for a quad => (x, y, z, w) becomes (z, y, x, w) (example : (0,0,1,1) becomes (1,0,0,1) ), but do it for 2 successive triangles instead
  4. set back the updated uvs with box.setVerticesData()

this should work :-)

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...