random_racer/src/ThirdPersonCameraHelper.h

Go to the documentation of this file.
00001 #ifndef _RR_THIRDPERSONCAMERAHELPER_H_
00002 #define _RR_THIRDPERSONCAMERAHELPER_H_
00003 
00004 #include <vrs/sharedobj.h>
00005 #include <vrs/vector.h>
00006 
00007 #include <random_utils/TimeableObject.h>
00008 
00009 namespace VRS
00010 {
00011 class LookAt;
00012 } // namespace VRS
00013 
00014 namespace vrsode
00015 {
00016 class CollisionBody;
00017 } // namespace vrsode
00018 
00019 
00020 namespace random_racer
00021 {
00022 
00027 class ThirdPersonCameraHelper : public VRS::SharedObj,
00028                                 private random_utils::TimeableObject
00029 {
00030     VRS::SO<VRS::LookAt>            m_lookAt;
00031     VRS::SO<vrsode::CollisionBody>  m_hook;
00032     double                          m_distX, m_distY, m_smoothing, m_correctY;
00033     bool                            m_staticY;
00034     VRS::Vector                     m_lastDirection;
00035     unsigned int                    m_delay;
00036 
00041     virtual void timerTick();
00042 
00043 public:
00069     ThirdPersonCameraHelper(
00070         VRS::SO<VRS::LookAt> lookAt,
00071         VRS::SO<vrsode::CollisionBody> hookBody,
00072         const VRS::Vector& initialDirection = VRS::Vector(),
00073         double distanceX = 12.0,
00074         double distanceY = 3.5,
00075         double correctY = 0.0,
00076         bool staticY = true,
00077         double smoothing = 0.976,
00078         unsigned int delay = 10);
00079 
00083     virtual ~ThirdPersonCameraHelper();
00084 
00088     inline double distanceX()
00089     {
00090         return m_distX;
00091     }
00092 
00096     inline void setDistanceX(double newDistance)
00097     {
00098         m_distX = newDistance;
00099     }
00100     
00104     inline double distanceY()
00105     {
00106         return m_distY;
00107     }
00108 
00112     inline void setDistanceY(double newDistance)
00113     {
00114         m_distY = newDistance;
00115     }
00116     
00120     inline double correctY()
00121     {
00122         return m_correctY;
00123     }
00124 
00129     inline void setCorrectY(double newCorrect)
00130     {
00131         m_correctY = newCorrect;
00132     }
00133 
00138     inline bool isStaticY()
00139     {
00140         return m_staticY;
00141     }
00142 
00146     inline void setStaticY(bool isStatic = true)
00147     {
00148         m_staticY = isStatic;
00149     }
00150 
00154     inline double smoothing()
00155     {
00156         return m_smoothing;
00157     }
00158 
00163     void setSmoothing(double newSmoothing);
00164 
00169     void updateLookAt();
00170 
00174     inline unsigned int delay()
00175     {
00176         return m_delay;
00177     }
00178 
00182     void setDelay(unsigned int msecs);
00183 };
00184 
00185 } // namespace random_racer
00186 
00187 
00188 #endif // _RR_THIRDPERSONCAMERAHELPER_H_

Generated on Fri May 11 21:01:58 2007 for Random Racer by  doxygen 1.5.1