3D view interaction modes
From Solid Graphics Wiki
A 3D view interaction mode is setting of a Window3D class object which defines how user's mouse and keyboard actions in the object's view window are interpreted into the view navigation actions (moving view's camera eye position or target position) or scene object's manipulation actions (such as moving an 3D object position or orientation). Other factors affecting the view navigation are the manipulation mode and the floor navigation mode settings.
The interaction modes provided by the SolidKit Library are enumerated in the SKL3D::Window3D::InteractionMode enum type. An interaction mode for a 3D view window can be activated/changed by calling the Window3D::SetInteractionMode method.
The Window3D class offers these interaction modes:
|None||In this mode mouse actions do not change view's camera or position/orientation of objects in the view.|
|Pan||In Pan interaction mode and depending also on the manipulation mode either camera's eye and target positions are moved based on mouse actions in the view window, and/or objects displayed in the view can also be moved using the mouse.
To move camera/object(s) click and drag mouse pointer inside the view. The camera/object(s) will be moved depending where the mouse pointer is dragged. To end moving camera/object(s) - release the mouse button.
To move object(s) in camera's Z-direction - hold the Z keyboard key while dragging mouse pointer (note that Z is default key for this action and the action key can be customized using the view's CommandTrigger class object, usually using the Customize Shortcuts Keys Dialog). Moving objects in Z-direction does not work in floor navigation mode or in SceneOnly manipulation mode.
|Rotate||Depending on currently selected manipulation mode this interaction mode allows either rotation of view camera's eye position around the camera's target position, and/or rotation of object(s) displayed in the view around the object(s) center point.
The scene rotation keeps the camera's target position - and the camera's eye position is rotated around the target position. The distance from the eye position to the target position is kept. The looking direction and up direction vectors are changed according to the specified rotation.
|Zoom||Allows to specify a rectangular area in the view window for zoom in or zoom out. The way to specify the rectangular area depends on the current view's projection type. To zoom out instead of zooming in - hold the Ctrl keyboard key while specifying the zoom rectangle (the key for this action can be customized).
In Orthographic projection
To specify the rectangle press the left mouse button in the view window to specify one of the rectangle corners, drag the mouse pointer to the opposite rectangle corner and release the left mouse button.
In Perspective projection
In perspective projection with FreePerspectiveZoom mode set to true the zoom rectangle specification method is the same as in the orthographic projection. However be aware that in this mode the result of zooming can be confusing sometimes as objects originally specified in zoom rectangle might not be visible after the view is zoomed. This can happen when zoom rectangle is significantly away from view's center and the objects distance to camera's eye position is significantly different than eye position distance to the camera target position.
In perspective projection and FreePerspectiveZoom mode set to false it is possible to specify only rectangles that have the same center point as the view window center point. To specify the rectangle, press the left mouse button in the view to specify one of the rectangle edges. Drag the rectangle edge to the desired position. To confirm the rectangle shape, release the left mouse button.
For zoom-in the view projection will be changed to fit the graphic data visible in the specified rectangle into the whole view window. For zoom-out the view projection will be changed to fit graphic data originally visible in the view into the specified zoom rectangle.
The zoom-window-action moves camera's target position to the center of the specified zoom rectangle. The camera's eye position is moved by the same translation as the target position is moved. Then the eye position is moved toward or from the target position depending whether the requested action zoom-in or zoom-out. The look direction and look-up direction vectors remain unchanged.
|SelectObject||Allows object selection. An object will be selected when clicking on it. More than one object can be selected by holding Left-Ctrl key while clicking on another object.
To allow object selection the application must provide QueryObjectPosInfo callback function. To allow multiple objects selection by specifying selection rectangle the application must provide QueryObjectsPosInfoByVolume callback method. See the MoveObjectsExample project file for example implementation of these methods.
|Fly||The Fly mode together with pan actions (using keyboard or program code) can be used to simulate plane or space ship like navigation through the scene.
In this interaction mode the mouse pointer is hidden, mouse movements to left and right movements are translated to look-left and look-right view changes, mouse forward and back movements are translated to look-up and look-down view projection changes. If Right-Ctrl key is pressed then mouse movement to left is translated to bank-view-to-left movement and mouse movement to right mouse is translated to bank-view-to-right movement. In contrast with the Rotate interaction mode mode - in the Fly mode the eye position remain fixed (during mouse-only manipulation) and target position is changing.
|FreeLook||This interaction mode is about the same as the mouse interaction mode used in first person shooter games, such as Doom or Crysis.
The FreeLook mode is similar to the Fly mode, except that in the FreeLook mode it is not possible to look up/down beyond a fixed "gravity vector", and that axis used to look left and right is always parallel with the "gravity vector". This simulates human perception of space in "environments with ground and gravity". The "gravity vector" is defined by the up direction which was current when the FreeLook mode started. If floor navigation mode is enabled then the "gravity vector" is taken from the floor plane vector. You can alter the "gravity vector" while in the FreeLook mode by setting up the up direction by the Window3D::SetUpDirection method.