1 #!/usr/bin/env python3.7
2 """Focus spectator at specific coordinates."""
5 if __name__ == "__main__":
7 print("./focus X,Y,HEADING")
9 client = carla.Client("localhost", 2000)
10 client.set_timeout(9999)
11 world = client.get_world()
12 settings = world.get_settings()
13 x, y, h = [float(i) for i in sys.argv[1].replace(" ", "").split(",")]
14 sr = carla.Rotation(yaw=h)
15 sl = carla.Location(x=x, y=y, z=10) - 20 * sr.get_forward_vector()
16 world.get_spectator().set_transform(carla.Transform(sl, sr))