Fix fall-through (spawn on terrain after collision built) and B&W (assign sky env)

This commit is contained in:
dev
2026-11-03 22:28:19 +00:00
parent bfe90a1b11
commit 5c58fad07b
4 changed files with 84 additions and 34 deletions

View File

@@ -2,18 +2,24 @@ extends Node3D
## M0 mood props — a few low-poly trees and rocks built from primitives in code,
## so the scene looks "alive" with no imported assets. These are placeholders;
## real low-poly models (free asset packs, see docs/ROADMAP.md M0) replace them.
##
## place_on(terrain) is called by world.gd once the terrain exists, so each prop
## sits on the real ground height instead of floating at Y=0.
func _ready() -> void:
# A deterministic scattering so it looks intentional, not random each run.
var _terrain: Node3D
func place_on(terrain: Node3D) -> void:
_terrain = terrain
var rng := RandomNumberGenerator.new()
rng.seed = 42
for i in range(18):
var x := rng.randf_range(-55.0, 55.0)
var z := rng.randf_range(-55.0, 55.0)
var y: float = _terrain.sample_height(x, z)
if rng.randf() < 0.65:
_make_tree(Vector3(x, 0, z), rng)
_make_tree(Vector3(x, y, z), rng)
else:
_make_rock(Vector3(x, 0, z), rng)
_make_rock(Vector3(x, y, z), rng)
func _make_tree(pos: Vector3, rng: RandomNumberGenerator) -> void:
var root := Node3D.new()