Physics-based inverse kinematics (IK) and inverse dynamics (ID)