Godot Version
4.3.stable
Question
I’m attempting to render a very simple mesh via ArrayMesh: two square planes, one on top of the other, with separate surfaces. I have this part working, but for some reason whenever I apply a texture as the material, it appears rotated on the mesh. Any idea how to fix this?
extends MeshInstance3D
func _ready() -> void:
var data = []
data.resize(ArrayMesh.ARRAY_MAX)
data[ArrayMesh.ARRAY_VERTEX] = PackedVector3Array([
Vector3(0,0,0),
Vector3(1,1,0),
Vector3(1,0,0),
Vector3(0,0,0),
Vector3(0,1,0),
Vector3(1,1,0)
])
data[ArrayMesh.ARRAY_TEX_UV] = PackedVector2Array([
Vector2(0,0),
Vector2(1,1),
Vector2(1,0),
Vector2(0,0),
Vector2(0,1),
Vector2(1,1)
])
mesh = ArrayMesh.new()
mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES,data)
#second surface
data[ArrayMesh.ARRAY_VERTEX] = PackedVector3Array([
Vector3(0,1,0),
Vector3(1,2,0),
Vector3(1,1,0),
Vector3(0,1,0),
Vector3(0,2,0),
Vector3(1,2,0)
])
data[ArrayMesh.ARRAY_TEX_UV] = PackedVector2Array([
Vector2(0,1),
Vector2(1,2),
Vector2(1,1),
Vector2(0,1),
Vector2(0,2),
Vector2(1,2)
])
mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES,data)
ResourceSaver.save(mesh, "res://mesh_test_flip3.tres", ResourceSaver.FLAG_COMPRESS)
The highlights of the tile should be facing the top left not the bottom left. No matter what I change in the vertex ordering it doesn’t seem to change this.






