From 1641080ff6f2a6b6cb27eded8f5dd741852233cf Mon Sep 17 00:00:00 2001 From: Sara Date: Mon, 8 Dec 2025 16:08:43 +0100 Subject: [PATCH] feat: noise height bases on 0 if height infinite --- modules/terrain_editor/terrain_primitive.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/terrain_editor/terrain_primitive.cpp b/modules/terrain_editor/terrain_primitive.cpp index 757d9e77..d5a0a548 100644 --- a/modules/terrain_editor/terrain_primitive.cpp +++ b/modules/terrain_editor/terrain_primitive.cpp @@ -117,6 +117,9 @@ void NoisePrimitive::_bind_methods() { void NoisePrimitive::evaluate(Vector2 at, float &io_height) const { if (this->noise.is_valid()) { + if (Math::is_nan(io_height) || Math::is_inf(io_height)) { + io_height = 0; + } float noise_sample{ this->noise->get_noise_2dv(at / this->noise_scale) }; noise_sample *= this->noise_amplitude; io_height = blend(io_height, io_height + noise_sample);