mElite  1.0
An Elite clone based on TextElite by Jan-Philipp Kappmeier and Melanie Schmidt.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | List of all members
MovingObject Class Reference

Provides the basic functions for an moving object. More...

#include <MovingObject.h>

Inheritance diagram for MovingObject:
GameObject CameraObject SpaceShip PlayerObject abstract PlayerObject

Public Member Functions

 MovingObject ()
 Constructor, initializes to the origin. The line of vision is aligned to the z axis, the up vector is aligned to the y-axis.
 
 MovingObject (Vector3 position)
 Constructor initializing to a given position as Vector3.
 
 MovingObject (float x, float y, float z)
 Constructor, the startposition is (x,y,z).
 
 ~MovingObject (void)
 Destructor.
 
void pitch (float angle)
 Pitches the line of vision.
 
void roll (float angle)
 Rolls the eye.
 
Vector3 getRight (void)
 Returns the vector indiciating what is 'right' of the eye.
 
Vector3 getUp (void)
 Returns the vector indication what is 'up'.
 
Vector3 getView (void)
 Returns the current viewing vector.
 
void setView (Vector3 v)
 Sets the current viewing vector.
 
void accelerate (float step)
 Sets the speed.
 
void advance (float t)
 Move the camera depending on the current speed and line of vision.
 
float getMaxSpeed (void)
 Returns the maximal speed.
 
float getMinSpeed (void)
 Returns the minimal speed.
 
float getSpeed (void)
 Returns the vector indicating the direction 'right'.
 
void setMaxSpeed (float speed)
 Sets the maximal speed.
 
void setMinSpeed (float speed)
 Sets the minimal speed.
 
void setSpeed (float speed)
 Sets the current speed.
 
void setStep (float step)
 Sets the value that is advanced in one step.
 
- Public Member Functions inherited from GameObject
 GameObject (void)
 The constructor creates the object. The position is set to zero by default.
 
 GameObject (Vector3 position)
 The constructor creates the object and gives it a position in the scene.
 
 GameObject (float x, float y, float z)
 The constructor creates the object and gives it a position in the scene.
 
 ~GameObject (void)
 Destructor. Does nothing.
 
virtual Vector3 getPos (void)
 Returns the current position as Vector3 triple.
 
void setPos (float x, float y, float z)
 Sets the current position.
 
void setPos (Vector3 position)
 Sets the current position.
 

Detailed Description

Provides the basic functions for an moving object.

The provided functionalitys are speed controlling, advancing and rotating in some directions (yaw, pith, roll).

Definition at line 16 of file MovingObject.h.

Constructor & Destructor Documentation

MovingObject::MovingObject ( )

Constructor, initializes to the origin. The line of vision is aligned to the z axis, the up vector is aligned to the y-axis.

Definition at line 14 of file MovingObject.cpp.

MovingObject::MovingObject ( Vector3  position)

Constructor initializing to a given position as Vector3.

Parameters
positionthe eye position

Definition at line 27 of file MovingObject.cpp.

MovingObject::MovingObject ( float  x,
float  y,
float  z 
)

Constructor, the startposition is (x,y,z).

Parameters
xx-coordinate vor eye point
yy-coordinate for eye point
zz-coordinate for eye point

Definition at line 42 of file MovingObject.cpp.

MovingObject::~MovingObject ( void  )

Destructor.

Definition at line 54 of file MovingObject.cpp.

Member Function Documentation

void MovingObject::accelerate ( float  step)

Sets the speed.

Positive values for acceleration, negative to decrease speed. Minimal and maximal speed are defined through the variables maxspeed and minspeed.

Parameters
stepdetermines the value to accelerate, a length of stride factor

Definition at line 115 of file MovingObject.cpp.

void MovingObject::advance ( float  t)

Move the camera depending on the current speed and line of vision.

Parameters
tsets the time in milliseconds

Definition at line 127 of file MovingObject.cpp.

float MovingObject::getMaxSpeed ( void  )

Returns the maximal speed.

Definition at line 134 of file MovingObject.cpp.

float MovingObject::getMinSpeed ( void  )

Returns the minimal speed.

Definition at line 141 of file MovingObject.cpp.

Vector3 MovingObject::getRight ( void  )

Returns the vector indiciating what is 'right' of the eye.

Definition at line 83 of file MovingObject.cpp.

float MovingObject::getSpeed ( void  )

Returns the vector indicating the direction 'right'.

Definition at line 148 of file MovingObject.cpp.

Vector3 MovingObject::getUp ( void  )

Returns the vector indication what is 'up'.

Definition at line 90 of file MovingObject.cpp.

Vector3 MovingObject::getView ( void  )

Returns the current viewing vector.

Definition at line 97 of file MovingObject.cpp.

void MovingObject::pitch ( float  angle)

Pitches the line of vision.

Rotates it along the x-axis to look up or down.

Parameters
anglethe angle of the rotation

Definition at line 63 of file MovingObject.cpp.

void MovingObject::roll ( float  angle)

Rolls the eye.

The up vector is rotated around the viewing vector.

Parameters
anglethe angle of the rotation

Definition at line 76 of file MovingObject.cpp.

void MovingObject::setMaxSpeed ( float  speed)

Sets the maximal speed.

Parameters
speeddetermines the speed

Definition at line 156 of file MovingObject.cpp.

void MovingObject::setMinSpeed ( float  speed)

Sets the minimal speed.

Parameters
speeddetermines the speed

Definition at line 164 of file MovingObject.cpp.

void MovingObject::setSpeed ( float  speed)

Sets the current speed.

Parameters
speedthe speed

Definition at line 172 of file MovingObject.cpp.

void MovingObject::setStep ( float  step)

Sets the value that is advanced in one step.

Parameters
stepthe stride

Definition at line 185 of file MovingObject.cpp.

void MovingObject::setView ( Vector3  v)

Sets the current viewing vector.

Definition at line 104 of file MovingObject.cpp.


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