generated from krampus/template-godot4
Bounded grid generation layers check distance from plane before generation
All checks were successful
linting & formatting / build (push) Successful in 49s
All checks were successful
linting & formatting / build (push) Successful in 49s
This commit is contained in:
parent
94f97ad3ae
commit
9cb5de8e93
@ -134,6 +134,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 18900, 25000, 18900)
|
|||||||
simple_construct_threshold = 0.4
|
simple_construct_threshold = 0.4
|
||||||
construct_height_factor_x = SubResource("Curve_kox75")
|
construct_height_factor_x = SubResource("Curve_kox75")
|
||||||
bounding_box = AABB(0, 0, 0, 5632, 400, 5632)
|
bounding_box = AABB(0, 0, 0, 5632, 400, 5632)
|
||||||
|
debug = true
|
||||||
noise_scale = Vector3(0.01, 0.01, 0.01)
|
noise_scale = Vector3(0.01, 0.01, 0.01)
|
||||||
|
|
||||||
[node name="MetroGridLayer2" parent="MetroQuadrant/UpperMetro" instance=ExtResource("4_fy7wq")]
|
[node name="MetroGridLayer2" parent="MetroQuadrant/UpperMetro" instance=ExtResource("4_fy7wq")]
|
||||||
|
|||||||
@ -4,9 +4,10 @@ class_name BoundedGridLayer extends GridLayer
|
|||||||
## Bounding box for the grid on the local XZ plane.
|
## Bounding box for the grid on the local XZ plane.
|
||||||
##
|
##
|
||||||
## Note that only feature handles are checked to be within the bounding box.
|
## Note that only feature handles are checked to be within the bounding box.
|
||||||
## The Y component of this AABB is not used.
|
|
||||||
@export var bounding_box: AABB
|
@export var bounding_box: AABB
|
||||||
|
|
||||||
|
@export var debug := false
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
var grid := _plane_size()
|
var grid := _plane_size()
|
||||||
@ -19,6 +20,9 @@ func _ready() -> void:
|
|||||||
func _generate(lod: WorldGen.LOD) -> bool:
|
func _generate(lod: WorldGen.LOD) -> bool:
|
||||||
var center := WorldGenManager.get_generation_point()
|
var center := WorldGenManager.get_generation_point()
|
||||||
var radius := WorldGenManager.get_lod_radius(lod)
|
var radius := WorldGenManager.get_lod_radius(lod)
|
||||||
|
|
||||||
|
# Only generate if the bounding box is within generation radius.
|
||||||
|
if absf((center * global_transform).y) + bounding_box.size.y < radius:
|
||||||
var rad_diff := Vector3(radius, 0, radius)
|
var rad_diff := Vector3(radius, 0, radius)
|
||||||
|
|
||||||
# Translate probe box limits to grid space
|
# Translate probe box limits to grid space
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user