diff --git a/Unity/AirLibWrapper/AirsimWrapper/Source/WorldSimApi.cpp b/Unity/AirLibWrapper/AirsimWrapper/Source/WorldSimApi.cpp index c8e5d7d025..0b41cdcd11 100644 --- a/Unity/AirLibWrapper/AirsimWrapper/Source/WorldSimApi.cpp +++ b/Unity/AirLibWrapper/AirsimWrapper/Source/WorldSimApi.cpp @@ -183,6 +183,16 @@ bool WorldSimApi::isRecording() const void WorldSimApi::setWind(const Vector3r& wind) const { simmode_->setWind(wind); -}; +} + +std::vector WorldSimApi::listVehicles() const +{ + auto vehicle_names = (simmode_->getApiProvider()->getVehicleSimApis()).keys(); + // Remove '' from the list, representing default vehicle + auto position = std::find(vehicle_names.begin(), vehicle_names.end(), ""); + if (position != vehicle_names.end()) + vehicle_names.erase(position); + return vehicle_names; +} #pragma endregion diff --git a/Unity/AirLibWrapper/AirsimWrapper/Source/WorldSimApi.h b/Unity/AirLibWrapper/AirsimWrapper/Source/WorldSimApi.h index 96a135dd51..d75eecacf4 100644 --- a/Unity/AirLibWrapper/AirsimWrapper/Source/WorldSimApi.h +++ b/Unity/AirLibWrapper/AirsimWrapper/Source/WorldSimApi.h @@ -62,6 +62,7 @@ class WorldSimApi : public msr::airlib::WorldSimApiBase virtual bool isRecording() const override; virtual void setWind(const Vector3r& wind) const override; + virtual std::vector listVehicles() const override; private: SimModeBase * simmode_;