Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | Namespace Members | Class Members

TerrainAgent Class Reference

#include <src/TerrainAgent.h>

Inheritance diagram for TerrainAgent:

Inheritance graph
[legend]
Collaboration diagram for TerrainAgent:

Collaboration graph
[legend]
List of all members.

Detailed Description

Adds terrain detection to the Agent class.

Default attitude correction policy is now keep up, with up defined by the terrain normal at the agent location. This allows the agents to keep their horizontal right on the floor, whatever the floor slope.

Note: The static class terrain field should be set up externally. By default, the agents consider Z=0 as the floor, and Z up the normal.

Author:
Nicolas Brodu


Public Member Functions

 TerrainAgent ()
 Public API ///////////////.
double getAltitude ()
const osg::Vec3d & getFloorNormal ()

Static Public Attributes

static TerrainInterfaceterrain = &planeTerrain

Protected Member Functions

virtual void updateIntegration (const double elapsedTime, const double currentTime)
 Perform integration update: The position is constrained to be above the terrain, and attitude is updated accordingly.
virtual void updateAI (const double elapsedTime, const double currentTime)
 Perform AI update: The position is constrained to be above the terrain, and attitude is updated accordingly.

Protected Attributes

double altitude
osg::Vec3d floorNormal


Member Function Documentation

void TerrainAgent::updateAI const double  elapsedTime,
const double  currentTime
[protected, virtual]
 

Perform AI update: The position is constrained to be above the terrain, and attitude is updated accordingly.

Two new internal variables are set for subclasse, which can be checked together with other state variables (position, attitude, etc...)

  • altitude: This variable is set to the position Z delta before calling the stubs If there was a terrain collision, it is strictly negative. Otherwise, it represents the altitude of this agent above the floor. At exact floor level, there is nothing done by default (consider no collision). The position field is not updated, this is done during integration update.
  • floorNormal: the floor normal at the agent location.

Subclasses should call this function at the beginning of their AI update routine

Reimplemented from Agent.

Reimplemented in ExplicitAIAgent, NeuronalAgent, and ExplicitAIAgent.

void TerrainAgent::updateIntegration const double  elapsedTime,
const double  currentTime
[protected, virtual]
 

Perform integration update: The position is constrained to be above the terrain, and attitude is updated accordingly.

Two new internal variables are set for subclasse, which can be checked together with other state variables (position, attitude, etc...)

  • altitude: This variable is set to the position Z delta before calling the stubs If there was a terrain collision, it is strictly negative. Otherwise, it represents the altitude of this agent above the floor. At exact floor level, there is nothing done by default (consider no collision). The newPosition.z() is set to the floor level in case of collision.
  • floorNormal: the floor normal at the agent location.

Subclasses should call this function at the beginning of their AI update routine

Reimplemented from Agent.

Reimplemented in CrogaiAgent.


The documentation for this class was generated from the following files:
Generated on Mon Mar 28 11:28:08 2005 for Crogai by  doxygen 1.4.1