Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: SoRayPickAction Problem

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2010
    Posts
    18

    SoRayPickAction Problem

    Hi,

    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:

    viewer.mode(acuSgViewer.MODE_VIEWING)

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

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

    dynObjects.insertChild(camera, 0)
    rpa.apply(self.asg.dynObjects)
    dynObjects.removeChild(camera)

    pickedPoint = rpa.getPickedPoint()


    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,
    artmansoft

  2. #2
    Junior Member Newbie
    Join Date
    Jan 2005
    Location
    San Diego, CA
    Posts
    20

    Re: SoRayPickAction Problem

    See response in Open Inventor Forum: http://www.mc3dviz.com/openinventor-...p=585#poststop

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •