fixating rotation around a dynamicly moving plain I have the following situation



The entire object is rigid. The bottom plate can rotate around the blue(z) axis. The torso should be rotation with it and the arm should rotate around the side of the torso.

Whenever I put the objects as parent of bone they will work in their default positions. However if I turn the base around 45° and then the arm the rotation will not be around the torso. Instead the arm detaches a bit.

Here is a video of what I mean:

https://www.youtube.com/watch?v=tkyDClpAtaM

I just want the bones to only rotate 90° to the normal of the location surface

Is there a way I can fix my rotation to a plain (torsoside) with its two axis as references?
When you click r for rotation you can limit the rotation on world axis by hitting ( xy or z) or on local axis ( xx, yy or zz)

first place the bones in a good way   


rotate around the local axis
or 
select the bone in pose mode 
in Bone Constraints add Limit rotation constraint
setup the constraint according to your needs (in this case see the image ) 
now the bone will only rotate around the desired axis


Bones setup:

    

Bone constraint :



result :