CodeSubWars 0.4.7b
CodeSubWars::CSWEngine Class Reference

#include <CSWEngine.h>

Inheritance diagram for CodeSubWars::CSWEngine:

Public Member Functions

virtual void setDirection (const double &fHAngle, const double &fVAngle)
 
virtual void setDirection (const Vector3D &vecDirection)
 
const Vector3D & getDirection () const
 
void setIntensity (const double fIntensity)
 
const double & getIntensity ()
 
- Public Member Functions inherited from CodeSubWars::CSWEquipment
bool isMoving () const
 
- Public Member Functions inherited from CodeSubWars::CSWObject
const std::string & getName () const
 

Detailed Description

This class encapsulates a machine that can "emit" a force in a direction. The maximal force is depend on the size of the engine (larger engines have more power than smaller ones). This has the property to emit sound that is depend on the currently emitting force.

Member Function Documentation

◆ getDirection()

const Vector3D & CodeSubWars::CSWEngine::getDirection ( ) const

Returns the normalized direction in the world coordinate system. This is the "forward" direction for positive intensity values.

Returns
The current direction in woorld coordinate system.

◆ getIntensity()

const double & CodeSubWars::CSWEngine::getIntensity ( )

Returns the current set normalized intensity in range [-1, 1].

◆ setDirection() [1/2]

void CodeSubWars::CSWEngine::setDirection ( const double &  fHAngle,
const double &  fVAngle 
)
virtual

Sets the direction relative to local initial set coordinate system. If a direction is given that the engine can not adjust, the maximal direction nearest to the given direction will be set. The maximal excursion of the new direction relative to it initial direction is 45 degree. The angular velocity for adjusting is 22.5 degree/second.

Parameters
fHAngleThe new horizontal angle, positiv means to the right. (in degree)
fVAngleThe new vertical angle, positiv means to the up. (in degree)

◆ setDirection() [2/2]

void CodeSubWars::CSWEngine::setDirection ( const Vector3D &  vecDirection)
virtual

Sets the direction relative to local initial set coordinate system. If a direction is given that the engine can not adjust, the maximal direction nearest to the given direction will be set. The maximal excursion of the new direction relative to it initial direction is 45 degree. The angular velocity for adjusting is 22.5 degree/second.

Parameters
vecDirectionThe new direction relative to its parent.

◆ setIntensity()

void CodeSubWars::CSWEngine::setIntensity ( const double  fIntensity)

Sets the intensity of the engine relative to its parent. The valid range is [-1, 1], where positive means toward and negative backward direction. Non-valid values are clipped against the valid range.

Parameters
fIntensityThe new intensity in range [-1, 1].

Generated at Sun Aug 7 2022 for project CodeSubWars. www.codesubwars.org