From 0966f90f08bf2519ce862981f28877442356081b Mon Sep 17 00:00:00 2001 From: Nemrav <> Date: Sun, 17 Nov 2024 18:10:40 -0400 Subject: update sim for billboards --- game/src/Game/GameSession/BillboardManager.gd | 28 +++++++-------------------- 1 file changed, 7 insertions(+), 21 deletions(-) (limited to 'game/src/Game') diff --git a/game/src/Game/GameSession/BillboardManager.gd b/game/src/Game/GameSession/BillboardManager.gd index ac1610b..298d3a8 100644 --- a/game/src/Game/GameSession/BillboardManager.gd +++ b/game/src/Game/GameSession/BillboardManager.gd @@ -47,32 +47,18 @@ func _ready(): multimesh.mesh.surface_set_material(0,material) - # Need to have one instance for every province - # need to get a list of province centers - #GameSingleton.get_mapmode_identifier(0) - #GameSingleton.get_mapmode_count() - - var positions_len = MapItemSingleton.get_province_count() - - - print(positions_len) - # Then resize (otherwise, changing the format is not allowed). - multimesh.instance_count = positions_len - multimesh.visible_instance_count = positions_len - print("===============") var positions = MapItemSingleton.get_province_positions() - print("===============") + + # Then resize (otherwise, changing the format is not allowed). + multimesh.instance_count = positions.size() + multimesh.visible_instance_count = positions.size() + var map_positions : PackedVector3Array = PackedVector3Array() for pos_in in positions: - var pos = _map_view._map_to_world_coords(pos_in)# + Vector3(0, 0.5 * SCALE_FACTOR, 0) + var pos = _map_view._map_to_world_coords(pos_in) map_positions.push_back(pos) - #print(positions) - #print(positions.size()) - # Set the transform of the instances. - #model.set_position( - #_map_view._map_to_world_coords(unit_dict[position_key]) - # + Vector3(0, 0.1 * MODEL_SCALE, 0)) + for i in multimesh.visible_instance_count: multimesh.set_instance_transform(i, Transform3D(Basis(), map_positions[i] -- cgit v1.2.3-56-ga3b1