import carla def get_pos(): client = carla.Client("localhost", 2000) client.set_timeout(10.0) world = client.get_world() spectator = world.get_spectator() t = spectator.get_transform() loc = t.location rot = t.rotation print("\n" + "="*40) print("CURRENT SPECTATOR POSITION") print("="*40) print(f"Location: x={loc.x:.3f}, y={loc.y:.3f}, z={loc.z:.3f}") print(f"Rotation: pitch={rot.pitch:.3f}, yaw={rot.yaw:.3f}, roll={rot.roll:.3f}") print("="*40) print("\nCopy-paste this into your script:") print(f"transform = carla.Transform(carla.Location(x={loc.x:.3f}, y={loc.y:.3f}, z={loc.z:.3f}), carla.Rotation(pitch={rot.pitch:.3f}, yaw={rot.yaw:.3f}, roll={rot.roll:.3f}))") if __name__ == "__main__": get_pos()