SoRayPickAction Problem


I have a code in which I’m using a SoTransform node for rotating the model instead of rotating the camera. At some point, I need to pick a point from the model using mouse left button. In the follwoing code:

viewer is an instance of SoQtExaminerViewer
event is an instance of SoEventCallback which is gotten from the mouse event handler
dynObjects is an instance of SoSeparator which contains the dynamic components of the model and its first child is the SoTransform node mentioned above.

Here is the actual code I used for picking a point:


vpr = viewer.getViewportRegion()
rpa = SoRayPickAction(vpr)

camera = viewer.getCamera()
pos = event.getNormalizedPosition(vpr)

dynObjects.insertChild(camera, 0)

pickedPoint = rpa.getPickedPoint()[/b]

The pickedPoint is not what I want, but it is a random point. It is either Null or points to a point other than the place that I pressed the mouse button.

Before I used the above method, i.e. when I was using rotation camera instead of model, it worked properly. The problem arises from the SoTransform node probably. Does anybody know any other way to get the picked point?

Thanks in advance,

See response in Open Inventor Forum: