Skip to content

Commit d19f192

Browse files
committed
Workaround physics interpolation making chunks flicker in Godot 4.4
1 parent 61d7a5b commit d19f192

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

addons/zylann.hterrain/hterrain_chunk.gd

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ func _init(p_parent: Node3D, p_cell_x: int, p_cell_y: int, p_material: Material)
2929
var rs := RenderingServer
3030

3131
_mesh_instance = rs.instance_create()
32+
33+
# Godot 4.4 introduced physics interpolation again, and it's always on.
34+
# Unfortunately that breaks terrain chunks, which start to flicker when created,
35+
# even though they don't move. Terrains are inherently static so that feature must not be used.
36+
# This feature is new in Godot 4.4 so to maintain compatibility with previous versions
37+
# we have to test if the method is available.
38+
# See https://github.com/Zylann/godot_heightmap_plugin/issues/475
39+
if rs.has_method(&"instance_set_interpolated"):
40+
rs.call(&"instance_set_interpolated", _mesh_instance, false)
3241

3342
if p_material != null:
3443
rs.instance_geometry_set_material_override(_mesh_instance, p_material.get_rid())
@@ -122,4 +131,3 @@ func set_render_layer_mask(mask: int):
122131
func set_cast_shadow_setting(setting: int):
123132
assert(_mesh_instance != RID())
124133
RenderingServer.instance_geometry_set_cast_shadows_setting(_mesh_instance, setting)
125-

0 commit comments

Comments
 (0)