@Scene.distanceToNearestPointTouchingTheLine(): 5th and 6th condition change from xLine >, < 0 to zLine >, < 0, which is correct and I misstyped before. @Scene.XYZtoIndexOfCube(): change from >, < to >=, <= to avoid returning out of range index of cube.