[ODE or PyODE] Restrict max distance between bodies

Hello. I’m using ODE to move character’s hand with mouse (something like Madness Interactive game) - setting linear velocity, and I’d like to restrict movement to sphere, I thought about mixing Slider Joint and Ball Joint, but I don’t know if it’s possible with them (I don’t know how to set Slider Joint max length). The second option is to add sphere or cylinder (because it’s 2d game) to collide, but I don’t know if ODE is able to do collision inside sphere/cylinder. Will anyone help me?

You could calculate the squared distance the hand has moved from the origin and compare it against the squared radius of the sphere. If the distance is larger, then it is farther than allowed and you can apply an inverse force to bounce it back in range, or however you want to handle it.