Tiles on a box

Ok,

I just don’t seem to get it.

How do I tile a texture on a box?

you have to scale textures coordinates of the box to the number of tiles you want, and set the wrap mode of the texture to repeat.



Box b=new Box(1.0f, 1.0f, 1.0f);

b.scaleTextureCoordinates(new Vector2f(10,10));

Texture2D t=assetManager.loadTexture(“path/to/your/texture.png”);

t.setWrap(WrapMode.Repeat);

Material m=new Material(assetManager, “Common/MatDefs/Misc/SimpleTetxured.j3md”);

m.setTexture(“m_ColorMap”, t);

Geometry geom=new Geomertry(“box”,b);

geom.setMaterial(m);



This code for example will tile a texture 10 times on a box.

Thank you!

I were missing scaleTextureCoordinates(). :slight_smile: