diff --git a/org.mixedrealitytoolkit.spatialmanipulation/Solvers/Follow.cs b/org.mixedrealitytoolkit.spatialmanipulation/Solvers/Follow.cs index 547b532d4..24c76e563 100644 --- a/org.mixedrealitytoolkit.spatialmanipulation/Solvers/Follow.cs +++ b/org.mixedrealitytoolkit.spatialmanipulation/Solvers/Follow.cs @@ -468,7 +468,7 @@ private bool AngularClamp(Vector3 refPosition, Quaternion refRotation, Vector3 c { Vector3 toTarget = currentPosition - refPosition; float currentDistance = toTarget.magnitude; - if (currentDistance <= 0) + if (currentDistance <= 0f) { // No need to clamp return false; @@ -476,6 +476,11 @@ private bool AngularClamp(Vector3 refPosition, Quaternion refRotation, Vector3 c toTarget.Normalize(); + if(toTarget == Vector3.zero) + { + return false; + } + // Start off with a rotation towards the target. If it's within leashing bounds, we can leave it alone. Quaternion rotation = Quaternion.LookRotation(toTarget, Vector3.up);