Skip to content
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