Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UNITY: Fix get images from multiple drones: simGetImages() was only retur… #4815

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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