Menge Plugin Examples
A Collection of Example Plugins for the Menge Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Protected Attributes | Friends | List of all members
Terrain::HeightFieldModifier Class Reference

Modify the preferred velocity based on a height field. More...

#include <VelModHeightField.h>

Inheritance diagram for Terrain::HeightFieldModifier:

Public Member Functions

 HeightFieldModifier ()
 Default constructor.
 
 HeightFieldModifier (HeightFieldPtr hfPtr)
 Constructor. More...
 
void setHeightField (HeightFieldPtr hfPtr)
 Sets the height field for this velocity modifier object to use. More...
 
BFSM::VelModifier * copy () const
 Copy method for this velocity modifier.
 
void adaptPrefVelocity (const Agents::BaseAgent *agent, Agents::PrefVelocity &pVel)
 adapt preferred velocity by pushing it away from the heightfield gradient More...
 

Protected Attributes

HeightFieldPtr _field
 The height field used to query elevation and gradient.
 
float _turnWeight
 The weighting factor for how the gradient effects direction.
 
float _upHillScale
 The uphill scale factor.
 
float _downHillScale
 The downhill scale factor.
 

Friends

class HeightFieldModifierFactory
 

Detailed Description

Modify the preferred velocity based on a height field.

Agents preferred velocities can be sped up, slowed, and turned based on their attempt to traverse a heightfield. The gradient of the height field is used to determine the new preferred velocity.

Direction is determined by a re-normalized, weighted sum of the gradient with the input preferred direction.

The resultant speed is a scaled factor of the input speed with the steepness of the gradient. Uphill and downhill speed changes are controlled separately – gradients which lie perpindicular to the input preferred direction will cause a direction change, but no speed change.

The output preferred velocity becomes a single velocity (instead of an arc). If the input preferred velocity spanned an arc, it will be collapsed to a single direction.

Constructor & Destructor Documentation

Terrain::HeightFieldModifier::HeightFieldModifier ( HeightFieldPtr  hfPtr)

Constructor.

Parameters
hfPtrA pointer to a height-field resource.

Member Function Documentation

void Terrain::HeightFieldModifier::adaptPrefVelocity ( const Agents::BaseAgent *  agent,
Agents::PrefVelocity &  pVel 
)

adapt preferred velocity by pushing it away from the heightfield gradient

Parameters
agentThe agent for which to modify preferred vel
pVelThe agent's current preferred velocity (having potentially been modified)
void Terrain::HeightFieldModifier::setHeightField ( HeightFieldPtr  hfPtr)
inline

Sets the height field for this velocity modifier object to use.

Parameters
hfPtrA managed pointer to the height field.

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