version 3.3

VRS::UfoPhysicalNavigation Class Reference

#include <vrs/sg/ufophysicalnavigation.h>

Inheritance diagram for VRS::UfoPhysicalNavigation:

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

List of all members.

Public Member Functions

 UfoPhysicalNavigation (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 heightSensitivity=0.1, 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 in geo coordinates.
void setMinHeight (double minHeight)
 Sets the minimum value for the flyer's height in geo coordinates.
double getSpeedSensitivity () const
 Returns the sensitivity of up/down motions of the mouse for changing the speed.
void setSpeedSensitivity (double)
 Sets the sensitivity of up/down motions of the mouse for changing the speed.
double getMaxLookDownAngle () const
void setMaxLookDownAngle (double angle)
 Sets the maximum angle to look down; must be 0 < angle < 89!
double getMinLookDownAngle () const
void setMinLookDownAngle (double angle)
 Sets the maximum angle to look down; must be 0 < angle < 89!
void setMinMaxLookDownAngles (double minAngle, double maxAngle)
 Sets the minimun and maximum angles to look down; must be 0 < angle < 89!
bool allowBackwardMovement () const
 Returns if a backward movement is allowed.
void setAllowBackwardMovement (bool yesNo)
 Sets if a backward movement is allowed (default: false);.
 VRS_TYPEINFO (UfoPhysicalNavigation, PhysicalNavigation)
 VRS_SERIALIZABLE (UfoPhysicalNavigation)

Protected Member Functions

virtual void translateInteractionIntoTargetPos (Vector &target, Vector &dir, float x, float y, double time_now, double time_lastCalc)
virtual bool validateTargetPosition (Vector &target, const Vector &oldTarget, const Vector &dir)
virtual
BehaviorNode::InvalidationHint 
processKeyEvent (KeyEvent *)
virtual void updateLookAt (const Vector &pos, const Vector &dir)
virtual void initPhysicalNavigation (const Vector &)
virtual bool keyCanWakeUpNavigation (KeyEvent *)
virtual InvalidationHint handle (Event *)
 For handling wheel events (changing look down angle).

Protected Attributes

float minHeight_


Detailed Description

The UfoNavigation simulates the cameraview out of an UFO gliding over a surface on a given height relative to the surface. The steering is similar to a glider, e.g. mouse motions to the left or right side of the windows will change the flying direction. Mouse motions to the upper or lower part will increase or decrease the UFO's velocity.

The UFO's height can be changed by pressing the up/down-arrow keys.

The keys "+" or "-" will are interpreted as changes in the angle of the looking down on the ground surface gradient.

The calculations of the smooth movements are based on a physical model. Mouseinteractions don't change the cameraposition, respectively the UFO's position, directly. They only change a virtual target. The UFO experiences a force from that virtual point comparable to a virtual spring which connects the target and the UFO. To prevent the UFO oscillating around the target, a friction is taken into account by filling the vacuum with a viscous medium.

To adjust the functionality to a given terrain, use the meterDefinition parameter! If you increase the speed because you think the UFO is to slow in your wide terrain, you will have to take into account that with a higher speed the UFO tends to oscillate around the target.

For detailled information about the physical model see notes of the class PhysicalNavigation.


Constructor & Destructor Documentation

VRS::UfoPhysicalNavigation::UfoPhysicalNavigation ( 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  heightSensitivity = 0.1,
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 Navigation. '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 'heightSensitivity': heightSensitivity is the sensitivity with that up/down changes invoked by arrow-keys are translated into changes of the UFO's height. Each time the specific key is pressed the height is de-/increased by (heightSensitivity*100) percent. heightSensitivity >= 0; Default: 0.1 '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::UfoPhysicalNavigation::getMinHeight (  )  const [inline]

Returns the minimum value for the flyer's height in geo coordinates.

void VRS::UfoPhysicalNavigation::setMinHeight ( double  minHeight  )  [inline]

Sets the minimum value for the flyer's height in geo coordinates.

double VRS::UfoPhysicalNavigation::getSpeedSensitivity (  )  const [inline]

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

void VRS::UfoPhysicalNavigation::setSpeedSensitivity ( double  val  )  [inline]

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

double VRS::UfoPhysicalNavigation::getMaxLookDownAngle (  )  const

Returns the maximum angle to look down on the terrain (0.0 == horizontal; 90.0 == vertical).

void VRS::UfoPhysicalNavigation::setMaxLookDownAngle ( double  angle  ) 

Sets the maximum angle to look down; must be 0 < angle < 89!

double VRS::UfoPhysicalNavigation::getMinLookDownAngle (  )  const

Returns the minimum angle to look down on the terrain (0.0 == horizontal; 90.0 == vertical).

void VRS::UfoPhysicalNavigation::setMinLookDownAngle ( double  angle  ) 

Sets the maximum angle to look down; must be 0 < angle < 89!

void VRS::UfoPhysicalNavigation::setMinMaxLookDownAngles ( double  minAngle,
double  maxAngle 
)

Sets the minimun and maximum angles to look down; must be 0 < angle < 89!

bool VRS::UfoPhysicalNavigation::allowBackwardMovement (  )  const

Returns if a backward movement is allowed.

void VRS::UfoPhysicalNavigation::setAllowBackwardMovement ( bool  yesNo  ) 

Sets if a backward movement is allowed (default: false);.

VRS::UfoPhysicalNavigation::VRS_TYPEINFO ( UfoPhysicalNavigation  ,
PhysicalNavigation   
)

VRS::UfoPhysicalNavigation::VRS_SERIALIZABLE ( UfoPhysicalNavigation   ) 

virtual void VRS::UfoPhysicalNavigation::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 bool VRS::UfoPhysicalNavigation::validateTargetPosition ( Vector target,
const Vector oldTarget,
const Vector dir 
) [protected, virtual]

Correct the target's height to the aiming height (currentHeight_). 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 false if the target position has been changed.

Reimplemented from VRS::PhysicalNavigation.

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

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

Reimplemented from VRS::PhysicalNavigation.

virtual void VRS::UfoPhysicalNavigation::updateLookAt ( const Vector pos,
const 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. Furthermore the viewing direction is rotated down to the terrain by the angle lookingDownOnTerrainAngle_. 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+viewingDir. A conversion between physical coordinations and world coordinations is taken into account.

Reimplemented from VRS::PhysicalNavigation.

virtual void VRS::UfoPhysicalNavigation::initPhysicalNavigation ( const Vector  )  [protected, virtual]

Projects the flying directory on a plane parallel to the terrain, so that the height won't change appart from height changes due to the terrain height profile. Detects the current height and sets the associated member variable. Thereafter PhysicalNavigation::initPhysicalNavigation() is called. This method initializes the camera's position to the given parameter. It also sets velocity, acceleration and all delta-values (d_position, d_velocity, d_acceleration) to zero. Furthermore the slow down control is deactivated.

Reimplemented from VRS::PhysicalNavigation.

virtual bool VRS::UfoPhysicalNavigation::keyCanWakeUpNavigation ( KeyEvent  )  [protected, virtual]

Defines the keys which can wake up the navigation. All keys which are processed in processKeyEvent wake the navigation up.

Reimplemented from VRS::PhysicalNavigation.

virtual InvalidationHint VRS::UfoPhysicalNavigation::handle ( Event  )  [protected, virtual]

For handling wheel events (changing look down angle).

Reimplemented from VRS::PhysicalNavigation.


Member Data Documentation

Defines the minimum height of the flyer in world coordinates. minHeight_ > 0; default: 0.0


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

Generated on Wed May 23 06:00:29 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact