Announcement

Collapse
No announcement yet.

Switching among Multiple Cameras with an SoSwitch?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Switching among Multiple Cameras with an SoSwitch?

    In Section 4.2 of Inventor Mentor Vol 1, there's a programming tip that says: "A switch node can be used to make one of several cameras active."

    I'm attempting to implement this in my C# code with two cameras in a scene, but when I change the whichChild value of my parent switch, the current camera doesn't become active in the view as well. (Meaning the view redraws from the new camera's perspective, but I can't interact with the view with the mouse for the new camera it switched to.)

    The example with a blinker node works correctly for me, but Is there an example of this tip working with a switch node? Does anyone have any idea of what I might be doing incorrectly?

    - Thanks

  • #2
    Originally posted by bd1929 View Post
    In Section 4.2 of Inventor Mentor Vol 1, there's a programming tip that says: "A switch node can be used to make one of several cameras active."

    I'm attempting to implement this in my C# code with two cameras in a scene, but when I change the whichChild value of my parent switch, the current camera doesn't become active in the view as well. (Meaning the view redraws from the new camera's perspective, but I can't interact with the view with the mouse for the new camera it switched to.)

    The example with a blinker node works correctly for me, but Is there an example of this tip working with a switch node? Does anyone have any idea of what I might be doing incorrectly?
    As you discovered, the Mentor tip is correct with respect to traversing the scene graph.

    However, if you are using a "viewer" class (e.g. SoWinExaminerViewer), the viewer does not automatically know that it is now supposed to control a different camera.

    After changing the Switch node, just call the viewer's SetCamera() method with the new/current camera object.

    Comment

    Working...
    X