Skip to content

Commit

Permalink
Fix accumulating height offset
Browse files Browse the repository at this point in the history
  • Loading branch information
TokisanGames committed May 27, 2024
1 parent 2734401 commit f593c53
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/terrain_3d_instancer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ void Terrain3DInstancer::add_instances(Vector3 p_global_position, Dictionary p_p
t = t.scaled(Vector3(t_scale, t_scale, t_scale));

// Position
height_offset += mesh_asset->get_height_offset() * t_scale + random_height * (UtilityFunctions::randf() - .5f);
position += rotation_axis * height_offset; // Offset along rotation axis
real_t offset = height_offset + mesh_asset->get_height_offset() * t_scale + random_height * (UtilityFunctions::randf() - .5f);
position += rotation_axis * offset; // Offset along rotation axis
t = t.translated(position);

// Color
Expand Down

0 comments on commit f593c53

Please sign in to comment.