Set up directionΒΆ

.set_up_direction() can help us set the global up direction.

 1import time
 2
 3import viser
 4
 5
 6def main() -> None:
 7    server = viser.ViserServer()
 8    server.scene.world_axes.visible = True
 9    gui_up = server.gui.add_vector3(
10        "Up Direction",
11        initial_value=(0.0, 0.0, 1.0),
12        step=0.01,
13    )
14
15    @gui_up.on_update
16    def _(_) -> None:
17        server.scene.set_up_direction(gui_up.value)
18
19    while True:
20        time.sleep(1.0)
21
22
23if __name__ == "__main__":
24    main()