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);