Fixed light and object placement.

This commit is contained in:
=
2026-04-27 17:46:56 +02:00
parent 3060d3d6f7
commit 6a7f4690f2
8 changed files with 67 additions and 16 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
+44
View File
@@ -0,0 +1,44 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://ccdohpxvolyvj"
path="res://.godot/imported/TilesNew.fbx-3e21a3fed203e7e5d17b1879a769f903.scn"
[deps]
source_file="res://Assets/Objects/TilesNew.fbx"
dest_files=["res://.godot/imported/TilesNew.fbx-3e21a3fed203e7e5d17b1879a769f903.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/root_script=null
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_name_suffixes=true
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=true
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
materials/extract=0
materials/extract_format=0
materials/extract_path=""
_subresources={}
fbx/importer=0
fbx/allow_geometry_helper_nodes=false
fbx/embedded_image_handling=1
fbx/naming_version=2
+1 -3
View File
@@ -32,9 +32,6 @@ bg_color = Color(0, 0, 0, 0.7647059)
[node name="World" type="Node3D" parent="." unique_id=770208789]
script = ExtResource("1_kldst")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="World" unique_id=690768533]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 177.60146, 0)
[node name="SteamworksHandler" type="Node" parent="." unique_id=1183440473]
script = ExtResource("2_b2bpf")
@@ -104,6 +101,7 @@ layout_mode = 2
size_flags_vertical = 3
[node name="CodingWindow" type="PanelContainer" parent="Control/MainUI/Content" unique_id=1576652491]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
+11 -4
View File
@@ -1,14 +1,21 @@
using Godot;
public partial class GameData
{
//Amount of layers generated
public static int ruinSize = 10;
//Width+Height of layers
public static int layerSize = 20;
//Current layer the player wants to see
public static int currentLayer = 0;
//The layer that is currently visible
public static int visibleLayer = 0;
//Determines if the player can move the camera or not (Necessary for input and options menu)
public static bool canMove = true;
//--- PLAYER ADJUSTABLE VALUES ---
//Color used in primary objects (e.g. Robots)
public static Color primaryColor = new Color("#276ac2");
//Color used in lights
public static Color lightColor = new Color("#7efff5");
//Amount of layers generated
public static int ruinSize = 10;
//Width+Height of layers
public static int layerSize = 20;
}
+9 -7
View File
@@ -88,23 +88,25 @@ public partial class Tile
private void SpawnLight(MeshInstance3D lightMesh, Placeholder placeholder, Transform3D transform)
{
Vector3 forward = (transform.Origin - placeholder.transform.Origin).Normalized();
MeshInstance3D light = new MeshInstance3D
{
Mesh = lightMesh.Mesh,
Position = placeholder.transform.Origin
};
light.AddChild(new OmniLight3D()
OmniLight3D lightSource = new OmniLight3D()
{
OmniAttenuation = 2f,
LightColor = new Color("#eae7ad"),
LightColor = GameData.lightColor,
ShadowEnabled = true,
LightEnergy = 5f,
LightEnergy = 100f,
LightIndirectEnergy = 1.5f,
Position = new Vector3(0.5f, 0, 0)
});
OmniRange = 20f,
Position = placeholder.transform.Origin
};
lightSource.Position.MoveToward(transform.Origin, 0.1f);
light.AddChild(lightSource);
ContentNode.AddChild(light);
light.LookAt(light.Position + forward, Vector3.Up);
light.LookAt(transform.Origin, Vector3.Up);
}
private void SpawnResource(MeshInstance3D resourceMesh, Placeholder placeholder, Transform3D transform)
+2 -2
View File
@@ -30,7 +30,7 @@ public partial class World : Node3D
foreach (var kvp in tileMeshes)
{
tilePlaceholders[kvp.Key] = new List<Placeholder>();
foreach (MeshInstance3D child in kvp.Value.GetChildren())
foreach (Node3D child in kvp.Value.GetChildren())
{
tilePlaceholders[kvp.Key].Add(new Placeholder(child.Name, child.Transform));
}
@@ -141,7 +141,7 @@ public partial class World : Node3D
int posX, posY;
while(currentLight < layerSize * 2)
while(currentLight < layerSize * layerSize / 2)
{
posX = rand.Next(layerSize);
posY = rand.Next(layerSize);