Sorry, I’m extremely late to the post and don’t even know if your an active user anymore. That said, have you ever heard of inverse kinematics? It’s a process where you take joint parameters into account when calculating where to place an object. To me it sounds exactly like what you need.
Just a warning however, you should have a basic understanding of algebra and trigonometry to make this work.