Spherical navmesh with constraint

Take a look at this thread that track how we solved this issue + moving sphere:

This is how we clamp to the sphere, our radius is 5.0 (hence the magic number).

        protected override Vector3 ClampToNavmesh(Vector3 position, out bool positionChanged)
        {
            // This code clamps the AI to the sphere of radius 5.0f
            positionChanged = false;
            // Normalize position then scale to radius of sphere
            Vector3 newPosition = Vector3.Normalize(position) * 5.0f;
            if (newPosition != position) positionChanged = true; // not sure what this does
            //Debug.Log(position.ToString());
            return newPosition;
        }