Skip to content

Commit

Permalink
fix remove instances slope inconsistency
Browse files Browse the repository at this point in the history
  • Loading branch information
Xtarsia committed Oct 18, 2024
1 parent 79e0266 commit db9f43f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/terrain_3d_instancer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,8 @@ void Terrain3DInstancer::remove_instances(const Vector3 &p_global_position, cons
// Use localised ring center
real_t radial_distance = localised_ring_center.distance_to(Vector2(t.origin.x, t.origin.z));
bool rng = radial_distance < UtilityFunctions::randf() * radius;
if (cell_quota > 0 && rng && data->is_in_slope(t.origin + global_local_offset, slope_range, invert)) {
Vector3 height_offset = t.basis.get_column(1) * mesh_asset->get_height_offset();
if (cell_quota > 0 && rng && data->is_in_slope(t.origin + global_local_offset - height_offset, slope_range, invert)) {
--cell_quota;
continue;
} else {
Expand Down

0 comments on commit db9f43f

Please sign in to comment.