From 73b098476450be4a3deb199268343e6d97679b63 Mon Sep 17 00:00:00 2001 From: stoofin <44447892+stoofin@users.noreply.github.com> Date: Fri, 27 Oct 2023 21:43:54 -0700 Subject: [PATCH] Fixed PlaneMesh tangents for 'Face X' orientation (cherry picked from commit 6099d9f3d10f672176d638be96f76906a58f0a74) --- scene/resources/primitive_meshes.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp index 204987cac9b..f84aba6c8f4 100644 --- a/scene/resources/primitive_meshes.cpp +++ b/scene/resources/primitive_meshes.cpp @@ -1301,7 +1301,11 @@ void PlaneMesh::_create_mesh_array(Array &p_arr) const { points.push_back(Vector3(-x, z, 0.0) + center_offset); } normals.push_back(normal); - ADD_TANGENT(1.0, 0.0, 0.0, 1.0); + if (orientation == FACE_X) { + ADD_TANGENT(0.0, 0.0, -1.0, 1.0); + } else { + ADD_TANGENT(1.0, 0.0, 0.0, 1.0); + } uvs.push_back(Vector2(1.0 - u, 1.0 - v)); /* 1.0 - uv to match orientation with Quad */ point++;