Skip to content

Commit

Permalink
fixes for PR
Browse files Browse the repository at this point in the history
  • Loading branch information
winthos committed Aug 20, 2024
1 parent b21ad9e commit 88c496c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
9 changes: 8 additions & 1 deletion unity/Assets/Scripts/AgentManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,13 @@ public void Initialize(ServerAction action) {
action.alwaysReturnVisibleRange;
}

//deprecation check for visibilityScheme
if(action.visibilityScheme != VisibilityScheme.Distance.ToString()) {
throw new ArgumentException(
$"Invalid visibilityScheme {action.visibilityScheme}. Must be 'Distance'."
);
}

//if multi agent requested, add duplicates of primary agent now
addAgents(action);
this.agents[0].m_Camera.depth = 9999;
Expand Down Expand Up @@ -2687,7 +2694,7 @@ public static VisibilityScheme GetVisibilitySchemeFromString(string visibilitySc
catch (ArgumentException ex) {
#pragma warning restore 0168
Debug.LogError(
"Error parsing visibilityScheme: '" + visibilityScheme + "' defaulting to Collider"
"Error parsing visibilityScheme: '" + visibilityScheme + "' defaulting to Distance Based"
);
}

Expand Down
22 changes: 12 additions & 10 deletions unity/Assets/Scripts/BaseFPSAgentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4560,11 +4560,12 @@ public void GetVisibleObjectsFromCamera(
Camera camera = m_Camera;
if (thirdPartyCameraId.HasValue) {
camera = agentManager.thirdPartyCameras[thirdPartyCameraId.Value];
if (this.visibilityScheme != VisibilityScheme.Distance) {
throw new System.NotImplementedException(
$"Visibility scheme {this.visibilityScheme} is not implemented for third party cameras. Default visibility scheme should be 'Distance'."
);
}
}

if (this.visibilityScheme != VisibilityScheme.Distance) {
throw new System.NotImplementedException(
$"Visibility scheme {this.visibilityScheme} is not compatible. Visibility scheme should be 'Distance'."
);
}

//only check visibility for objects with these ids otherwise check them all
Expand Down Expand Up @@ -4614,17 +4615,18 @@ public void GetVisibleObjects(
Camera camera; //which camera are we checking visibility from?
if (thirdPartyCameraIndex.HasValue) {
camera = agentManager.thirdPartyCameras[thirdPartyCameraIndex.Value];
if (this.visibilityScheme != VisibilityScheme.Distance) {
throw new System.NotImplementedException(
$"Visibility scheme {this.visibilityScheme} is not implemented for third party cameras. Default visibility scheme should be 'Distance'."
);
}
}
//can also be used to query main camera
else {
camera = m_Camera;
}

if (this.visibilityScheme != VisibilityScheme.Distance) {
throw new System.NotImplementedException(
$"Visibility scheme {this.visibilityScheme} is not compatible. Visibility scheme should be 'Distance'."
);
}

List<SimObjPhysics> filterSimObjs = null;
if (objectIds != null) {
foreach (string objectId in objectIds) {
Expand Down

0 comments on commit 88c496c

Please sign in to comment.