16 lines
533 B
Python
16 lines
533 B
Python
# This recipe turn visibility off and on for two specifc buildings on the map
|
|
|
|
# Get the buildings in the world
|
|
world = client.get_world()
|
|
env_objs = world.get_environment_objects(carla.CityObjectLabel.Buildings)
|
|
|
|
# Access individual building IDs and save in a set
|
|
building_01 = env_objs[0]
|
|
building_02 = env_objs[1]
|
|
objects_to_toggle = {building_01.id, building_02.id}
|
|
|
|
# Toggle buildings off
|
|
world.enable_environment_objects(objects_to_toggle, False)
|
|
# Toggle buildings on
|
|
world.enable_environment_objects(objects_to_toggle, True)
|