How to apply constraints to limb movements of a 3D human model?

I’m animating a 3D human model using playcanvas game engine according to the quaternion data provided by IMU sensors. How can I limit the movements of the limbs of the human model to avoid unrealistic postures?