Bring the diamond island into main.tscn with region-border props
Promote debug/HexDiamondIsland.gd to terrain.gd at project root now that main.tscn depends on it, and swap it in for the old flat checkerboard Ground (Player/Camera/POI untouched, table sits at the same y=0 the old ground surface used). Add _build_region_borders(): places mountain.glb/mountain2v5.glb/ forest.glb (same models, scale factors and hitbox sizes already used elsewhere in main.tscn) continuously along the 6 ridges between table corners and girdle corners, i.e. the shared edges between adjacent outer regions.
This commit is contained in:
parent
fb14fe868d
commit
817c701bd1
@ -1,7 +1,7 @@
|
|||||||
[gd_scene format=3]
|
[gd_scene format=3]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://bia8axed2ndwj" path="res://debug/FreeCam.gd" id="1_freecam"]
|
[ext_resource type="Script" uid="uid://bia8axed2ndwj" path="res://debug/FreeCam.gd" id="1_freecam"]
|
||||||
[ext_resource type="Script" path="res://debug/HexDiamondIsland.gd" id="2_hexdi"]
|
[ext_resource type="Script" uid="uid://cpo34pbk0145n" path="res://terrain.gd" id="2_hexdi"]
|
||||||
|
|
||||||
[sub_resource type="Environment" id="Environment_hexdi"]
|
[sub_resource type="Environment" id="Environment_hexdi"]
|
||||||
background_mode = 1
|
background_mode = 1
|
||||||
|
|||||||
31
main.tscn
31
main.tscn
@ -1,7 +1,7 @@
|
|||||||
[gd_scene format=3 uid="uid://bju1lndv8l1mo"]
|
[gd_scene format=3 uid="uid://bju1lndv8l1mo"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://ckrqvbqw08kin" path="res://player.gd" id="1_0xm2m"]
|
[ext_resource type="Script" uid="uid://ckrqvbqw08kin" path="res://player.gd" id="1_0xm2m"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c3ajv7vb8c4fb" path="res://assets/debug/checkerboard.png" id="1_1bvp3"]
|
[ext_resource type="Script" uid="uid://cpo34pbk0145n" path="res://terrain.gd" id="1_terrain"]
|
||||||
[ext_resource type="Texture2D" uid="uid://epcqli428yem" path="res://assets/sprites/player/debug_player.png" id="2_h2yge"]
|
[ext_resource type="Texture2D" uid="uid://epcqli428yem" path="res://assets/sprites/player/debug_player.png" id="2_h2yge"]
|
||||||
[ext_resource type="Script" uid="uid://b0y06y7c0bihj" path="res://camera_rig.gd" id="3_h2yge"]
|
[ext_resource type="Script" uid="uid://b0y06y7c0bihj" path="res://camera_rig.gd" id="3_h2yge"]
|
||||||
[ext_resource type="PackedScene" uid="uid://be6ufrc3dsjge" path="res://poi.tscn" id="5_lquwl"]
|
[ext_resource type="PackedScene" uid="uid://be6ufrc3dsjge" path="res://poi.tscn" id="5_lquwl"]
|
||||||
@ -13,22 +13,6 @@
|
|||||||
ambient_light_color = Color(0, 0, 0.31764707, 1)
|
ambient_light_color = Color(0, 0, 0.31764707, 1)
|
||||||
ambient_light_energy = 0.3
|
ambient_light_energy = 0.3
|
||||||
|
|
||||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_lquwl"]
|
|
||||||
albedo_texture = ExtResource("1_1bvp3")
|
|
||||||
|
|
||||||
[sub_resource type="CylinderMesh" id="CylinderMesh_lquwl"]
|
|
||||||
top_radius = 100.0
|
|
||||||
bottom_radius = 100.0
|
|
||||||
height = 0.2
|
|
||||||
|
|
||||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_h2yge"]
|
|
||||||
shading_mode = 0
|
|
||||||
albedo_color = Color(0, 0.32156864, 0, 1)
|
|
||||||
|
|
||||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_lquwl"]
|
|
||||||
height = 0.2
|
|
||||||
radius = 100.0
|
|
||||||
|
|
||||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_7mycd"]
|
[sub_resource type="CylinderShape3D" id="CylinderShape3D_7mycd"]
|
||||||
height = 0.5
|
height = 0.5
|
||||||
radius = 0.16
|
radius = 0.16
|
||||||
@ -189,17 +173,8 @@ environment = SubResource("Environment_h2yge")
|
|||||||
|
|
||||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=630943989]
|
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=630943989]
|
||||||
|
|
||||||
[node name="Ground" type="StaticBody3D" parent="." unique_id=309197966]
|
[node name="Terrain" type="Node3D" parent="." unique_id=309197966]
|
||||||
|
script = ExtResource("1_terrain")
|
||||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Ground" unique_id=479475733]
|
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00084638596, -0.2, -0.001806736)
|
|
||||||
material_override = SubResource("StandardMaterial3D_lquwl")
|
|
||||||
mesh = SubResource("CylinderMesh_lquwl")
|
|
||||||
surface_material_override/0 = SubResource("StandardMaterial3D_h2yge")
|
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Ground" unique_id=1301061872]
|
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.2, 0)
|
|
||||||
shape = SubResource("CylinderShape3D_lquwl")
|
|
||||||
|
|
||||||
[node name="Player" type="CharacterBody3D" parent="." unique_id=1504574304 groups=["player"]]
|
[node name="Player" type="CharacterBody3D" parent="." unique_id=1504574304 groups=["player"]]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.25, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.25, 0)
|
||||||
|
|||||||
@ -12,14 +12,27 @@ extends Node3D
|
|||||||
@export var pavilion_depth : float = 190.0 # Höhenabfall Rundiste -> Spitze
|
@export var pavilion_depth : float = 190.0 # Höhenabfall Rundiste -> Spitze
|
||||||
@export var angle_offset_deg: float = 0.0
|
@export var angle_offset_deg: float = 0.0
|
||||||
|
|
||||||
|
@export var border_spacing : float = 18.0 # Abstand zwischen Grenz-Props entlang eines Grats
|
||||||
|
@export var border_jitter : float = 3.0 # zufälliger seitlicher Versatz
|
||||||
|
|
||||||
const COLOR_TABLE := Color(0.75, 0.74, 0.70)
|
const COLOR_TABLE := Color(0.75, 0.74, 0.70)
|
||||||
const COLOR_FACET_A := Color(0.55, 0.55, 0.48)
|
const COLOR_FACET_A := Color(0.55, 0.55, 0.48)
|
||||||
const COLOR_FACET_B := Color(0.49, 0.49, 0.43)
|
const COLOR_FACET_B := Color(0.49, 0.49, 0.43)
|
||||||
const COLOR_PAVILION := Color(0.30, 0.28, 0.26)
|
const COLOR_PAVILION := Color(0.30, 0.28, 0.26)
|
||||||
|
|
||||||
|
# Grenz-Props: gleiche Modelle + Skalierung + Hitbox-Maße wie in main.tscn
|
||||||
|
const MOUNTAIN_SCENE := preload("res://assets/models/mountain.glb")
|
||||||
|
const MOUNTAIN2_SCENE := preload("res://assets/models/mountain2v5.glb")
|
||||||
|
const FOREST_SCENE := preload("res://assets/models/forest.glb")
|
||||||
|
|
||||||
|
const MOUNTAIN_SCALE := 0.1
|
||||||
|
const MOUNTAIN2_SCALE := 0.05
|
||||||
|
const FOREST_SCALE := 0.2
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
_build_crown()
|
_build_crown()
|
||||||
_build_pavilion()
|
_build_pavilion()
|
||||||
|
_build_region_borders()
|
||||||
|
|
||||||
func _hex_angle(k: int) -> float:
|
func _hex_angle(k: int) -> float:
|
||||||
return deg_to_rad(angle_offset_deg) + float(k) / 6.0 * TAU
|
return deg_to_rad(angle_offset_deg) + float(k) / 6.0 * TAU
|
||||||
@ -103,3 +116,66 @@ func _build_pavilion() -> void:
|
|||||||
mi.name = "Pavilion"
|
mi.name = "Pavilion"
|
||||||
mi.mesh = mesh
|
mi.mesh = mesh
|
||||||
add_child(mi)
|
add_child(mi)
|
||||||
|
|
||||||
|
# ═══════════════════════════════════════════════
|
||||||
|
# GRENZEN — Berg/Wald entlang der 6 Grate zwischen den Regionen
|
||||||
|
# Grat k = Strecke von Tisch-Ecke T[k] zu Rundiste-Ecke G[k]
|
||||||
|
# (gemeinsame Kante von Facette k-1 und Facette k)
|
||||||
|
# ═══════════════════════════════════════════════
|
||||||
|
func _build_region_borders() -> void:
|
||||||
|
var borders := Node3D.new()
|
||||||
|
borders.name = "Borders"
|
||||||
|
add_child(borders)
|
||||||
|
|
||||||
|
for k in range(6):
|
||||||
|
var a := _hex_angle(k)
|
||||||
|
var dir := Vector3(cos(a), 0.0, sin(a))
|
||||||
|
var perp := Vector3(-dir.z, 0.0, dir.x)
|
||||||
|
|
||||||
|
var t := table_radius
|
||||||
|
while t <= girdle_radius:
|
||||||
|
var frac := (t - table_radius) / (girdle_radius - table_radius)
|
||||||
|
var pos := dir * t
|
||||||
|
pos.y = lerp(0.0, -crown_drop, frac)
|
||||||
|
pos += perp * randf_range(-border_jitter, border_jitter)
|
||||||
|
|
||||||
|
_place_border_prop(borders, pos)
|
||||||
|
t += border_spacing + randf_range(-4.0, 4.0)
|
||||||
|
|
||||||
|
func _place_border_prop(parent: Node3D, pos: Vector3) -> void:
|
||||||
|
var roll := randf()
|
||||||
|
var inst: Node3D
|
||||||
|
var scale_factor: float
|
||||||
|
var shape: Shape3D
|
||||||
|
|
||||||
|
if roll < 0.4:
|
||||||
|
inst = MOUNTAIN_SCENE.instantiate() as Node3D
|
||||||
|
scale_factor = MOUNTAIN_SCALE
|
||||||
|
var cap := CapsuleShape3D.new()
|
||||||
|
cap.radius = 7.0
|
||||||
|
cap.height = 20.0
|
||||||
|
shape = cap
|
||||||
|
elif roll < 0.7:
|
||||||
|
inst = MOUNTAIN2_SCENE.instantiate() as Node3D
|
||||||
|
scale_factor = MOUNTAIN2_SCALE
|
||||||
|
var cap2 := CapsuleShape3D.new()
|
||||||
|
cap2.radius = 8.5078125
|
||||||
|
cap2.height = 17.015625
|
||||||
|
shape = cap2
|
||||||
|
else:
|
||||||
|
inst = FOREST_SCENE.instantiate() as Node3D
|
||||||
|
scale_factor = FOREST_SCALE
|
||||||
|
var cyl := CylinderShape3D.new()
|
||||||
|
cyl.radius = 0.72021484
|
||||||
|
cyl.height = 2.2817383
|
||||||
|
shape = cyl
|
||||||
|
|
||||||
|
inst.position = pos
|
||||||
|
inst.rotation.y = randf() * TAU
|
||||||
|
inst.scale = Vector3.ONE * scale_factor
|
||||||
|
|
||||||
|
var cs := CollisionShape3D.new()
|
||||||
|
cs.shape = shape
|
||||||
|
inst.add_child(cs)
|
||||||
|
|
||||||
|
parent.add_child(inst)
|
||||||
1
terrain.gd.uid
Normal file
1
terrain.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://cpo34pbk0145n
|
||||||
Loading…
x
Reference in New Issue
Block a user