A method for automatic alignment of a position and orientation indicator with respect to a body part is provided. The method comprises the steps: attaching a position and orientation indicator (2, 4) to a body part (3, 5); moving the body part and measuring movements of the position and orientation indicator; and exploiting physical constraints to motion to determine the alignment of the position and orientation indicator with respect to the body part.