BIK: Full Body IK Solver

This should definitely work with terrains as well any objects which can handle collisions.