Skip to content

Commit

Permalink
Hotfix get images from multiple drones: simGetImages() was only retur…
Browse files Browse the repository at this point in the history
…ning images for one drone when asking for images from multiple drones
  • Loading branch information
shabpompeiano committed Mar 22, 2023
1 parent 6688d27 commit fd26441
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Unity/UnityDemo/Assets/AirSimAssets/Scripts/Vehicles/Vehicle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,25 @@ private void InitializeVehicle() {
captureResetEvent = new AutoResetEvent(false);
}

private GameObject FindChildWithTag(GameObject parent, string tag) {
GameObject child = null;

foreach(Transform transform in parent.transform) {
if(transform.CompareTag(tag)) {
child = transform.gameObject;
break;
}
}

return child;
}

//Register all the capture cameras in the scene for recording and data capture.
//Make sure every camera is a child of a gameobject with tag "CaptureCameras"
private void SetUpCameras() {
GameObject camerasParent = GameObject.FindGameObjectWithTag("CaptureCameras");
GameObject this_vehicle = GameObject.Find(this.name);
GameObject camerasParent = FindChildWithTag(this_vehicle, "CaptureCameras");

if (!camerasParent) {
Debug.LogWarning("No Cameras found in the scene to capture data");
return;
Expand Down

0 comments on commit fd26441

Please sign in to comment.