version 3.3

VRS::FlyerPhysicalNavigation Class Reference

#include <vrs/sg/flyerphysicalnavigation.h>

Inheritance diagram for VRS::FlyerPhysicalNavigation:

VRS::PhysicalNavigation VRS::Navigation VRS::Manipulator VRS::Interaction VRS::LeafBehavior VRS::BehaviorNode VRS::SharedObj VRS::Visitable

List of all members.

Public Member Functions

 FlyerPhysicalNavigation (LookAt *lookAt=NULL, InputEvent::Button button=InputEvent::MouseButton1, InputEvent::Modifier must_modifier=InputEvent::NoModifier, InputEvent::Modifier must_not_modifier=InputEvent::NoModifier, double meterDefinition=1.0, double minHeight=0.0, double speed=1.0, FilterTag *filterTag=NULL, Vector gravitationDir=Vector(0.0,-1.0, 0.0), PhysicalForce::ForceMode forceMode=PhysicalForce::Spring)
double getMinHeight () const
 Returns the minimum value for the flyer's height.
void setMinHeight (double minHeight)
 Sets the minimum value for the flyer's height.
double getLeftrightSensitivity () const
 Returns the sensitivity of right/left motions of the mouse for changing the view direction.
void setLeftrightSensitivity (double)
 Sets the sensitivity of right/left motions of the mouse for changing the view direction.
double getUpdownSensitivity () const
 Returns the sensitivity of up/down motions of the mouse for changing the view direction.
void setUpdownSensitivity (double)
 Sets the sensitivity of up/down motions of the mouse for changing the view direction.
double getSpeed () const
 Returns the actual speed of the flyer.
void setSpeed (double)
 Sets the actual speed of the flyer.
 VRS_TYPEINFO (FlyerPhysicalNavigation, PhysicalNavigation)
 VRS_SERIALIZABLE (FlyerPhysicalNavigation)

Protected Member Functions

virtual void translateInteractionIntoTargetPos (Vector &target, Vector &dir, float x, float y, double time_now, double time_lastCalc)
virtual
BehaviorNode::InvalidationHint 
processKeyEvent (KeyEvent *)
virtual bool validateTargetPosition (Vector &target, const Vector &oldTarget, const Vector &dir)
virtual void updateLookAt (Vector pos, Vector dir)

Protected Attributes

double minHeight_
double speed_


Detailed Description

The FlyerPhysicalNavigation simulates the cameraview out of an flyer. The difference of a physicalflyer and a conventional flyer navigation is, that the movements are smooth, e.g. there is no discontinous change neither in the position nor in the velocity of the flyer. Furthermore a heightcheck is performed that prevents the flyer from crashing into the geometry scene. This elaborate check takes the height of the terrain or object into account which are situated in the actual flight direction. The smooth movement are obtained by taking a physical model into account. The user won't change the flyer's position directly with his mouse interactions. He just changes a virtual target point. The flyer experiences a virtual attracting force from this target. You could compare the situation by the image of a donkey which is trying to get e carrot which is situated in front of his head. By changing the carrot's position, you can guide the donkey's movements. To prevent the flyer oscillating around the target, the movement of the flyer are simulated as movements in a viscous liquid.

The control of a physicalflyer is done by mouse interactions. Mousemotions in the vertical direction turn the viewing direction up and down. Horizontal motions thurn the direction to the right or left. The speed can be incremented or decremented by pressing the + or - key.

To adjust the functionality to a given terrain, use the meterDefinition parameter! The meterDef parameter translates the world coordination system to coordinations of the physical model. This is necessairy because the motions in the physical model are in respect to a real meter unit. If you do not define a reasonable meter strange behavior will be produced like oscillations of the flyer around the target. So better adjust the meterDef parameter than the speed to correct the flying speed for the given terrain!!!


Constructor & Destructor Documentation

VRS::FlyerPhysicalNavigation::FlyerPhysicalNavigation ( LookAt lookAt = NULL,
InputEvent::Button  button = InputEvent::MouseButton1,
InputEvent::Modifier  must_modifier = InputEvent::NoModifier,
InputEvent::Modifier  must_not_modifier = InputEvent::NoModifier,
double  meterDefinition = 1.0,
double  minHeight = 0.0,
double  speed = 1.0,
FilterTag filterTag = NULL,
Vector  gravitationDir = Vector(0.0,-1.0, 0.0),
PhysicalForce::ForceMode  forceMode = PhysicalForce::Spring 
)

'lookAt': specifies the LookAt object the Navigation is assigned to. 'target' must not be NULL. 'button': specifies the mouse button that have to be pressed to use the SmoothflyerNavigation. 'must_modifier': if must_modifier is not InputEvent::NoModifier, the navigation processes mouse events only if the must_modifier key is hold down. 'must_not_modifier': if must_not_modifier is not InputEvent::NoModifier, the navigation processes mouse events only if the must_not_modifier key is not hold down. 'meterDefinition': The physical model works in an own coordination system. So position, velocity and accelleration of the camera and also the target position are described in the physical coordination system. To convert values described in physical coordinations to world coordination, the meter definition is used. Important: Use the meter definition to adapt the physical model to the scene geometry. Be aware of an abnormal high speed of the camera. meterDefinition > 0; default: 1.0 'minHeight': defines the minimum height of the flyer minHeight > 0; default = 0.0 'speed': speed of the flyer speed > 0; default = 1.0 'filterTag': A filter tag is passed as parameter to define which scene objects are regarded as ground terrain. Without filter tag all scene objects define the ground terrain. 'gravitationDir': Defines the direction of the gravitation, e.g. it defines what "under" an object means. gravitationDir is essential for a reasonable definition of "height". 'forceMode' : The operating physical force which defines the physical behavior of the navigation set by a passed parameter to the constructor. Possible values are defined in the enum ForceMode in PhysicalForce. For each forceMode exists a class, derived from PhysicalForce, which provides the method calcforceDifferential(). PhysicalNavigation holds an instance of a PhysicalForce as a member variable. See above: Question 2.


Member Function Documentation

double VRS::FlyerPhysicalNavigation::getMinHeight (  )  const [inline]

Returns the minimum value for the flyer's height.

void VRS::FlyerPhysicalNavigation::setMinHeight ( double  minHeight  ) 

Sets the minimum value for the flyer's height.

double VRS::FlyerPhysicalNavigation::getLeftrightSensitivity (  )  const [inline]

Returns the sensitivity of right/left motions of the mouse for changing the view direction.

void VRS::FlyerPhysicalNavigation::setLeftrightSensitivity ( double  leftrightSensitivity  )  [inline]

Sets the sensitivity of right/left motions of the mouse for changing the view direction.

double VRS::FlyerPhysicalNavigation::getUpdownSensitivity (  )  const [inline]

Returns the sensitivity of up/down motions of the mouse for changing the view direction.

void VRS::FlyerPhysicalNavigation::setUpdownSensitivity ( double  updownSensitivity  )  [inline]

Sets the sensitivity of up/down motions of the mouse for changing the view direction.

double VRS::FlyerPhysicalNavigation::getSpeed (  )  const [inline]

Returns the actual speed of the flyer.

void VRS::FlyerPhysicalNavigation::setSpeed ( double   ) 

Sets the actual speed of the flyer.

VRS::FlyerPhysicalNavigation::VRS_TYPEINFO ( FlyerPhysicalNavigation  ,
PhysicalNavigation   
)

VRS::FlyerPhysicalNavigation::VRS_SERIALIZABLE ( FlyerPhysicalNavigation   ) 

virtual void VRS::FlyerPhysicalNavigation::translateInteractionIntoTargetPos ( Vector target,
Vector dir,
float  x,
float  y,
double  time_now,
double  time_lastCalc 
) [protected, virtual]

This method defines how the user controls the navigation. x and y are the normalized mouse position (in respect to the first click point and the window size). This method sets the new target position and the viewing/flight direction.

Implements VRS::PhysicalNavigation.

virtual BehaviorNode::InvalidationHint VRS::FlyerPhysicalNavigation::processKeyEvent ( KeyEvent  )  [protected, virtual]

If handle() gets a KeyEvent processKeyEvent() will process it. Checks key event for key"+" or "-" and increases or decreases the speed.

Reimplemented from VRS::PhysicalNavigation.

virtual bool VRS::FlyerPhysicalNavigation::validateTargetPosition ( Vector target,
const Vector oldTarget,
const Vector dir 
) [protected, virtual]

Check if the target has a valid position, i.e. if the height didn't fall below the minimum height. If so the adjusted target is set. Furthermore the height of objects situated in the flighing direction are regarded. With this elaborated look-forward approach the height is increased at an early stage. This helps preventing collisions with scene geometry. Also a check is performed if the target violates a given constraint. validateTargetPosition() returns true if the target position is valid.

Reimplemented from VRS::PhysicalNavigation.

virtual void VRS::FlyerPhysicalNavigation::updateLookAt ( Vector  pos,
Vector  dir 
) [protected, virtual]

Check if cameras's position fell below a fifth of the minimum height. This prevents the camera crashing into an object. The disadvantage is the discontinuos motion in the case of a crash. After that test PhysicalNavigation::updateLookAt() is called, i.e. The lookAt is updated. The From-Vector is set to pos, the To-Vector is set to pos+dir. A conversion between physical coordinations and world coordinations is taken into account.


Member Data Documentation

Defines the minimum height of the flyer in physical coordinations. minHeight_ > 0; default: 0.2

Speed of the flyer. speed_ > 0; default: 1.0


The documentation for this class was generated from the following file:

Generated on Mon May 21 06:00:26 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact