Locking object rotation to specific axis

This is done in Kangaroo with rigid body goals. Sorry but I cannot share the definition.