Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion 2D/Behaviors/SteerForSphericalObstacles2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public static PathIntersection FindNextIntersectionWithSphere(Vehicle2D vehicle,
}

// use pythagorean theorem to calculate distance out of the sphere (if you do it 2D, the line through the circle would be a chord and we need half of its length)
var halfChord = Mathf.Sqrt(combinedRadius * combinedRadius + obstacleDistanceToPath * obstacleDistanceToPath);
var halfChord = Mathf.Sqrt(combinedRadius * combinedRadius - obstacleDistanceToPath * obstacleDistanceToPath);

// if the projected obstacle center lies opposite to the movement direction (aka "behind")
if (projectionLength < 0)
Expand Down
2 changes: 1 addition & 1 deletion 3D/Behaviors/SteerForSphericalObstacles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public static PathIntersection FindNextIntersectionWithSphere(Vehicle vehicle, V
}

// use pythagorean theorem to calculate distance out of the sphere (if you do it 2D, the line through the circle would be a chord and we need half of its length)
var halfChord = Mathf.Sqrt(combinedRadius * combinedRadius + obstacleDistanceToPath * obstacleDistanceToPath);
var halfChord = Mathf.Sqrt(combinedRadius * combinedRadius - obstacleDistanceToPath * obstacleDistanceToPath);

// if the projected obstacle center lies opposite to the movement direction (aka "behind")
if (projectionLength < 0)
Expand Down