random_racer::ThirdPersonCameraHelper Class Reference

The ThirdPersonCameraHelper updates a LookAt object according to the position of a CollisionBody it is attached to. More...

#include <ThirdPersonCameraHelper.h>

Inheritance diagram for random_racer::ThirdPersonCameraHelper:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 ThirdPersonCameraHelper (VRS::SO< VRS::LookAt > lookAt, VRS::SO< vrsode::CollisionBody > hookBody, const VRS::Vector &initialDirection=VRS::Vector(), double distanceX=12.0, double distanceY=3.5, double correctY=0.0, bool staticY=true, double smoothing=0.976, unsigned int delay=10)
 Ctor, creates you a new ThirdPersonCameraHelper.
virtual ~ThirdPersonCameraHelper ()
 Dtor, does nothing special.
double distanceX ()
 Returns the current distance of the x-axis (back).
void setDistanceX (double newDistance)
 Sets the current x-axis distance to a new value.
double distanceY ()
 Returns the current distance of the y-axis (up).
void setDistanceY (double newDistance)
 Sets the current y-axis distance to this new value.
double correctY ()
 Returns the y correction.
void setCorrectY (double newCorrect)
 Sets the new correction which gets added upwards to the cars position.
bool isStaticY ()
 Returns true of false depending on if the y-axis is static or relative.
void setStaticY (bool isStatic=true)
 Sets the staticness of the y-axis to this new value.
double smoothing ()
 Returns the current smoothing value.
void setSmoothing (double newSmoothing)
 Sets the smoothing to this new value, see the Ctor for how different values affect the result.
void updateLookAt ()
 Updates the LookAt object by reading position and rotation of the CollisionBody hook.
unsigned int delay ()
 Returns the current cam delay in miliseconds.
void setDelay (unsigned int msecs)
 Sets a new delay for the cam.

Private Member Functions

virtual void timerTick ()
 This has to be implemented for TimeableObject and updates the camera every m_delay miliseconds.

Private Attributes

VRS::SO< VRS::LookAt > m_lookAt
VRS::SO< vrsode::CollisionBodym_hook
double m_distX
double m_distY
double m_smoothing
double m_correctY
bool m_staticY
VRS::Vector m_lastDirection
unsigned int m_delay

Detailed Description

The ThirdPersonCameraHelper updates a LookAt object according to the position of a CollisionBody it is attached to.

Definition at line 27 of file ThirdPersonCameraHelper.h.


Constructor & Destructor Documentation

random_racer::ThirdPersonCameraHelper::ThirdPersonCameraHelper ( VRS::SO< VRS::LookAt >  lookAt,
VRS::SO< vrsode::CollisionBody hookBody,
const VRS::Vector &  initialDirection = VRS::Vector(),
double  distanceX = 12.0,
double  distanceY = 3.5,
double  correctY = 0.0,
bool  staticY = true,
double  smoothing = 0.976,
unsigned int  delay = 10 
)

Ctor, creates you a new ThirdPersonCameraHelper.

Parameters:
lookAt The LookAt object we should manipulate
hookBody The CollisionBody, from which we read its position and rotation every update.
distanceX The distance of the camera backwards from the hook.
distanceY The distance of the camera up from the hook.
correctY How much the camera looks 'over' the car, use this to see 'more' of the sky and less of the ground.
staticY Controls whether distanceY gets added to the y- component of the camera or gets replaced by it (true means to replace).
smoothing This is the delay by which the camera follows the car, setting this to higher values means a smoother, but also slower movement of the camera. The value should lie between 0.0 and 1.0, 0.0 means to not interpolate at all.

random_racer::ThirdPersonCameraHelper::~ThirdPersonCameraHelper (  )  [virtual]

Dtor, does nothing special.

Definition at line 45 of file ThirdPersonCameraHelper.cpp.


Member Function Documentation

void random_racer::ThirdPersonCameraHelper::timerTick (  )  [private, virtual]

This has to be implemented for TimeableObject and updates the camera every m_delay miliseconds.

Implements random_utils::TimeableObject.

Definition at line 81 of file ThirdPersonCameraHelper.cpp.

References updateLookAt().

Here is the call graph for this function:

double random_racer::ThirdPersonCameraHelper::distanceX (  )  [inline]

Returns the current distance of the x-axis (back).

Definition at line 88 of file ThirdPersonCameraHelper.h.

References m_distX.

void random_racer::ThirdPersonCameraHelper::setDistanceX ( double  newDistance  )  [inline]

Sets the current x-axis distance to a new value.

Definition at line 96 of file ThirdPersonCameraHelper.h.

References m_distX.

double random_racer::ThirdPersonCameraHelper::distanceY (  )  [inline]

Returns the current distance of the y-axis (up).

Definition at line 104 of file ThirdPersonCameraHelper.h.

References m_distY.

void random_racer::ThirdPersonCameraHelper::setDistanceY ( double  newDistance  )  [inline]

Sets the current y-axis distance to this new value.

Definition at line 112 of file ThirdPersonCameraHelper.h.

References m_distY.

double random_racer::ThirdPersonCameraHelper::correctY (  )  [inline]

Returns the y correction.

Definition at line 120 of file ThirdPersonCameraHelper.h.

References m_correctY.

void random_racer::ThirdPersonCameraHelper::setCorrectY ( double  newCorrect  )  [inline]

Sets the new correction which gets added upwards to the cars position.

Definition at line 129 of file ThirdPersonCameraHelper.h.

References m_correctY.

bool random_racer::ThirdPersonCameraHelper::isStaticY (  )  [inline]

Returns true of false depending on if the y-axis is static or relative.

Definition at line 138 of file ThirdPersonCameraHelper.h.

References m_staticY.

void random_racer::ThirdPersonCameraHelper::setStaticY ( bool  isStatic = true  )  [inline]

Sets the staticness of the y-axis to this new value.

Definition at line 146 of file ThirdPersonCameraHelper.h.

References m_staticY.

double random_racer::ThirdPersonCameraHelper::smoothing (  )  [inline]

Returns the current smoothing value.

Definition at line 154 of file ThirdPersonCameraHelper.h.

References m_smoothing.

void random_racer::ThirdPersonCameraHelper::setSmoothing ( double  newSmoothing  ) 

Sets the smoothing to this new value, see the Ctor for how different values affect the result.

Definition at line 40 of file ThirdPersonCameraHelper.cpp.

References random_utils::inRange(), and m_smoothing.

Here is the call graph for this function:

void random_racer::ThirdPersonCameraHelper::updateLookAt (  ) 

Updates the LookAt object by reading position and rotation of the CollisionBody hook.

Definition at line 49 of file ThirdPersonCameraHelper.cpp.

References m_correctY, m_distX, m_distY, m_hook, m_lastDirection, m_lookAt, m_smoothing, and m_staticY.

Referenced by timerTick().

Here is the caller graph for this function:

unsigned int random_racer::ThirdPersonCameraHelper::delay (  )  [inline]

Returns the current cam delay in miliseconds.

Definition at line 174 of file ThirdPersonCameraHelper.h.

References m_delay.

void random_racer::ThirdPersonCameraHelper::setDelay ( unsigned int  msecs  ) 

Sets a new delay for the cam.

Definition at line 74 of file ThirdPersonCameraHelper.cpp.

References m_delay, and random_utils::TimeableObject::startTimer().

Here is the call graph for this function:


Member Data Documentation

VRS::SO<VRS::LookAt> random_racer::ThirdPersonCameraHelper::m_lookAt [private]

Definition at line 30 of file ThirdPersonCameraHelper.h.

Referenced by updateLookAt().

VRS::SO<vrsode::CollisionBody> random_racer::ThirdPersonCameraHelper::m_hook [private]

Definition at line 31 of file ThirdPersonCameraHelper.h.

Referenced by updateLookAt().

double random_racer::ThirdPersonCameraHelper::m_distX [private]

Definition at line 32 of file ThirdPersonCameraHelper.h.

Referenced by distanceX(), setDistanceX(), and updateLookAt().

double random_racer::ThirdPersonCameraHelper::m_distY [private]

Definition at line 32 of file ThirdPersonCameraHelper.h.

Referenced by distanceY(), setDistanceY(), and updateLookAt().

double random_racer::ThirdPersonCameraHelper::m_smoothing [private]

Definition at line 32 of file ThirdPersonCameraHelper.h.

Referenced by setSmoothing(), smoothing(), and updateLookAt().

double random_racer::ThirdPersonCameraHelper::m_correctY [private]

Definition at line 32 of file ThirdPersonCameraHelper.h.

Referenced by correctY(), setCorrectY(), and updateLookAt().

bool random_racer::ThirdPersonCameraHelper::m_staticY [private]

Definition at line 33 of file ThirdPersonCameraHelper.h.

Referenced by isStaticY(), setStaticY(), and updateLookAt().

VRS::Vector random_racer::ThirdPersonCameraHelper::m_lastDirection [private]

Definition at line 34 of file ThirdPersonCameraHelper.h.

Referenced by updateLookAt().

unsigned int random_racer::ThirdPersonCameraHelper::m_delay [private]

Definition at line 35 of file ThirdPersonCameraHelper.h.

Referenced by delay(), and setDelay().


The documentation for this class was generated from the following files:
Generated on Fri May 11 21:02:14 2007 for Random Racer by  doxygen 1.5.1