To save yourself a lot of time -
First step in debugging: examine your code for obvious typos and logic errors.
Second step in debugging: before asking someone else to stare at your code, at a minimum, gather some information about the problem. See if you can find the problem yourself, or, at a minimum, find a few lines of code (say, less than 50 ) where the problem occurs. Set breakpoints in your code and, when running the program, examine actual values of variables at several points in your code where you think the problem may be. Determine if those values are what you expect. At some point you'll find incorrect values. Continue to set breakpoints to determine where "good" values turn to "bad" values. The problem is occurring between those two points in your code.
1. For information, does "unityMatrix" mean identity matrix?
2. Have you confirmed that OBB.rotationMatrix represents only the OBB's local rotation?
3. Have you confirmed OBB.center is (for your example) ( 100, 0, 0 )?
By "confirm," I mean, as mentioned above, setting breakpoints in your code and examining the actual values while the code is running.
Then the collision will fail at a certain threshold ... Is it clear now?
Not really.
Some tough love. Although you've posted some code, you post is still "Here's some code. It doesn't work sometimes ["doesn't work" and "sometimes" not defined]. What's wrong?" E.g., it's not clear what you mean by "doesn't work," "is not right any more," or "threshold." The code detects hits when it shouldn't? Doesn't detect hits when it should? Detects hit with a wrong location? Does "threshhold" mean distance between the sphere and the box? Rotation of the box? A combination of the two? The size of the sphere? The size of the box?
When you determine an error condition (bad hit, distance, rotation??), set up that condition in your program, even setting hard-coded values for sphere/box parameters. Then go to the second step for debugging mentioned above.
Without knowing what problem you're having (other than there may be a problem in some 50-60 lines of code), I would just make a guess than you're making assumptions about the results of your rotation calcs, and the signed comparisons with the box extents.