Adapt Limit Location Constraint to Bounds of Mesh Object I recently asked a question here looking for advice on constraining a bone to within the internal space of a custom mesh object, using the default bone constraints available in Blender. I've been messing around with this issue myself since, and haven't been able to devise a suitable system or at least had an idea that might be workable - judging by the lack of response, neither has anyone else.

I've all but given up on doing this using the currently available constraints, though I still think that it is such an intuitive feature (at least in my view) that surely someone's come up with a method before? Instead, I think this may only be possible with coding. As someone who is completely new to coding using python and in Blender (though definitely keen to learn), this is quite a daunting task and I was wondering if someone might be able to give me a few pointers.

For anyone that doesn't want to check the link to see exactly what I'm after, I'll briefly explain what I'm looking for:

Essentially, I want to be able to quickly and easily (after the system's been developed, of course) select a specific mesh object such as a cube, sphere or other such arbitrarily shaped entity and make it so that the bone is unable to move outside of this object. It would be able to occupy any location within the object, and on its surface, but not exceed its surface. 

In the images below I show the would-be constrained bones (in green) inside 3 different shaped objects (within the volume or on the surface), and 1 additional (grey) bone to show that a bone without the constraint would be able to be placed anywhere as usual (assuming no other constraint was applied). Hopefully this clarifies the problem.

  

In the original question I provided descriptions of exactly why the other most promising constraints fail to achieve this.

As I have said, I'm still very much open to ways to do this without using code, but I'm increasingly feeling as if that is not possible. I'm also not necessarily asking for some genius to go away and create this system for me (though by all means do so if you wish!), but I'm more looking for pointers about whether this is even possible and if so how someone might go about it.

My gut instinct is that it would be easier to adapt the Limit Location Constraint already in Blender rather than start from scratch, but I may be completely wrong in this assumption.

Any help is greatly appreciated.
With the release of Blender 2.8, there is now a solution to this issue within the mode type section of the Shrinkwrap bone constraint - called 'Inside', it limits the movement of a bone to within a specified mesh object. This is exactly what I was after. More info can be found here in an answer I wrote to the original question.