Texture on 1 face of cube

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GameVisitor

Hi all,

I am making my 3D game using only Godot (nothing from blender) based on primitive types. I have been using MeshInstance of type plane for my floors but saw on youtube than plane are not recommended and will be deprecated.

Given this I decided to replace them with CubeMesh , however i am unable to have my textures displayed exactly as they were before (since the plane is now represented by 1 of cube faces). Can someone provide basic Godot tips of how to adjust the texture so it displays either full on 1 face of the cube or repeatedly on each face ?

I am no expert, and tried to play with the Geometry -> material override -> Uv1 and Uv2 scale properties without success (getting the texture displayed many times on same cube face).

Additional question: What is the difference and what are the pros / cons of:

Mesh -> Material 

or

Mesh -> Geometry Instance -> Material Override

Thx

:bust_in_silhouette: Reply From: Calinou

Try setting the UV1 to 3, 2, 1. You should get a result similar to this.

Thx for ur feedback, it kind of worked, meaning in the editor i got the result i wanted.
However, I am randomly selecting a texture for the floor upon level starting and the ones selected are not being resized as i wanted (as per your solution).

I even tried adding the scale thru the code, however now, textures are displayed as simple black or white…

var newMat = SpatialMaterial.new()
newMat.albedo_texture = itex
newMat.flags_unshaded = true
newMat.uv1_scale = Vector3(3,2,1)

Any idea ?

PS: I am using Mesh -> Material in case it matters.

GameVisitor | 2019-05-18 15:37