Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

groundmovement.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           groundmovement.h  -  description
00003                              -------------------
00004     begin                : Sat Jul 28 2001
00005     copyright            : (C) 2001 by T Kontkanen
00006     email                : tkontkanen@mail.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef GROUNDMOVEMENT_H
00019 #define GROUNDMOVEMENT_H
00020 
00021 #include "renderer.h"
00022 #include "ground.h"
00023 #include "game.h"
00024 #include "allincludes.h"
00025 #include "gamedefs.h"
00026 #include "vector.h"
00027 
00033 class GroundMovement {
00034 public: 
00035 //  GroundMovement( Renderer *prenderer, Ground *pground );
00036     GroundMovement( Game *pgame );
00037     ~GroundMovement();
00038 
00039     Vector &getPosition() { return position; }
00040     float getSpeed() { return velocity; }
00041     float getAngle() { return angle; }
00042     float getPitch() { return pitch; }
00043     float getTilt() { return tilt; }
00044 
00045     //action
00046     void moveSetDestination( Vector destpos ) { destPosition=destpos; }
00047     Vector &moveGetDestination() { return destPosition; }
00048     void moveStep(); // make a move (one call per frame)
00049     
00050     void setPosition( Vector &pos ) {
00051         position=pos;
00052         position.setZ(mGround->getElevation( pos.x(), pos.y() ) );//set elevation
00053         moveSetDestination( pos );
00054     }
00055     void setTurnRate( float rate ) { turnrate=rate; }
00056     void setTopSpeed( float speed ) { topspeed=speed; }
00057     void setAcceleration( float a ) { acceleration=a; }
00058     
00059 private:
00060     // own data
00061     bool isSomethingOnMyWay( Vector direction );
00062     
00063     Vector position, destPosition;
00064     float angle, pitch, tilt; //angle=z-axis rotation, pitch=x-axis and tilt=y-axis
00065     float velocity; /* m/s */
00066     float turnrate /* rad/s */, acceleration /* m/sē */, topspeed /* m/s */;
00067     float positionTolerance; // destination position tolerance in meters (radius)
00068     float turnrange_near, turnrange_far, radarresolution; // distance when unit starts turnign if wall or other unit is detected ahead
00069     
00070     //needed information, don't use same names with Unit to avoid conficts (may be unnecessary?)
00071     Renderer *mRenderer;
00072     Ground *mGround;
00073     Game *mGame;
00074 };
00075 
00076 #endif

Generated at Fri Oct 5 20:23:52 2001 for Executor by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001