I am trying to create a feature where the user can click the face of a model in the viewer and the camera will orient itself normal to the selected face.
The approach I followed was was capturing the details of the normal of the face from the viewer.hitTest(), the setting the camera at a point along this normal targeted at the original clicked point using the setPosition() method. I noticed however this was not working with some models. On further inspection I noticed that the face normal reported by the hitTest() was in a different coordinate system compared to the camera. I am trying to create a feature where the user can click the face of a model in the viewer and the camera will orient itself normal to the selected face. The approach I followed was was capturing the details of the normal of the face from the viewer.hitTest(), the setting the camera at a point along this normal targeted at the original clicked point using the setPosition() method. I noticed however this was not working with some models. On further inspection I noticed that the face normal reported by the hitTest() was in a different coordinate system compared to the camera. For the same direction camera and face normal report in different coordinate systems The models source is a .dwfx file generated from an inventor .iam file Is there another approach I could try that would work regardless if the coordinate systems line up or not? Or is there a way to find out the difference in rotations of the coordinate systems programmatically?
From these 2 answers(1,2), i got the cameraview to face the fragid.