Controlling the Viewpoint
Motivation
- By default, the viewer enters a world at (0, 0, 10)
- You can provide your own preferred view points
- Select the entry point position
- Select favorite views for the viewer
- Name the views for a browser menu
Creating Viewpoints
- Viewpoints specify a desired location, an orientation, and a camera field of view lens angle
- Viewpoints can be transformed using a Transform node
- The first viewpoint found in a file is the entry point
Syntax: Viewpoint
A Viewpoint node specifies a named viewing location:
- position and orientation - viewing location
- fieldOfView - camera lens angle
- description - description for viewpoint menu
XML Encoding
1
2
3
4
5
<Viewpoint
position='0 0 10'
orientation='0 0 1 0'
fieldOfView='0.785'
description='Entry View'/>
Classic VRML Encoding
1
2
3
4
5
6
Viewpoint {
position 0 0 10
orientation 0 0 1 0
fieldOfView 0.785
description "Entry View"
}
Example
The Jump Field
Basically, if the jump field is set to false and the viewpoint receives a set_bind event with a value of true, the viewpoint is bound. However, the position and orientation remain the same as the previous bound viewpoint, including any user navigation offsets. This is useful if you want to programme an elevator or train, for example. Imagine a user bound to Viewpoint A enters an elevator. When they enter, they are bound to a new Viewpoint B inside the elevator coordinate system. You can now animate the elevator and the user will move with it. When the lift stops and the user exits, they are bound again to Viewpoint A, which is in the floor coordinate system. If both viewpoints A and B have jump set to false, you will not recognize any viewpoint change.
If jump is set to true and the viewpoint receives a set_bind event, you will be bound to the viewpoint and the new position and orientation will take effect. If you are not happy with the transition, set the NavigationInfo transitionType to TELEPORT. This will immediately apply the new position and orientation.
Summary
- Specify favorite viewpoints in Viewpoint nodes
- The first viewpoint in the file is the entry viewpoint