From 59384ce345683684e3c119165b963f012a26a753 Mon Sep 17 00:00:00 2001 From: veclavtalica Date: Fri, 2 Aug 2024 03:50:35 +0300 Subject: [PATCH] only generate floor for region looked from inside --- Scripts/Space/SpaceRegion.gd | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Scripts/Space/SpaceRegion.gd b/Scripts/Space/SpaceRegion.gd index 20e1bab..b962f73 100644 --- a/Scripts/Space/SpaceRegion.gd +++ b/Scripts/Space/SpaceRegion.gd @@ -19,15 +19,16 @@ func _generate_geometry(space: Space, looked_from_inside: bool) -> Node3D: var mesh := ArrayMesh.new() mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, _generate_wall_arrays(space, looked_from_inside)) - mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, _generate_floor_arrays(space)) var wall_material := StandardMaterial3D.new() wall_material.albedo_texture = wall_texture mesh.surface_set_material(0, wall_material) - var floor_material := StandardMaterial3D.new() - floor_material.albedo_texture = floor_texture - mesh.surface_set_material(1, floor_material) + if (looked_from_inside): + mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, _generate_floor_arrays(space)) + var floor_material := StandardMaterial3D.new() + floor_material.albedo_texture = floor_texture + mesh.surface_set_material(1, floor_material) geometry.mesh = mesh @@ -53,7 +54,7 @@ func _generate_wall_arrays(space: Space, looked_from_inside: bool) -> Array: arrays.resize(Mesh.ARRAY_MAX) arrays[Mesh.ARRAY_VERTEX] = vertices arrays[Mesh.ARRAY_TEX_UV] = uvs - + return arrays