How to prevent IK from allowing limbs to clip through character?

Hello, everyone!

I want to use IK to procedurally generate animations for equipping weapons in my game and some searching lead me to this topic:

The method outlined in the topic is perfect besides one small issue. If the goal position is behind the character, the limbs clip through the character. Since the weapons in my game will be on the player’s back, this behavior isn’t desirable.

What can I do to prevent limbs from clipping through the character and instead go behind the character’s head?

If anything I said was unclear, please ask for clarification.



[30 characters (fdfsfdsds)]