Skip to content

Commit

Permalink
Disable terrain collider when it's invisible
Browse files Browse the repository at this point in the history
  • Loading branch information
kb173 committed Aug 28, 2019
1 parent f5fadf1 commit a43ad42
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions World/LODTerrain/Modules/TerrainColliderModule.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@ var collider_subdivision = Settings.get_setting("terrain-collider", "collision-m


func _ready():
connect("visibility_changed", self, "_on_visibility_changed")
tile.thread_task(self, "get_textures", [])


# When this node becomes invisible due to higher LOD terrain being active, disable the collider
func _on_visibility_changed():
if is_visible_in_tree():
col_shape.disabled = true
else:
col_shape.disabled = false


func _on_ready():
if heightmap:
col_shape.shape = create_tile_collision_shape()
Expand Down

0 comments on commit a43ad42

Please sign in to comment.