AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
TransportBase Class Referenceabstract

#include "VehicleDefines.h"

Inheritance diagram for TransportBase:
Transport Vehicle MotionTransport StaticTransport

Public Member Functions

virtual void CalculatePassengerPosition (float &x, float &y, float &z, float *o=nullptr) const =0
 This method transforms supplied transport offsets into global coordinates. More...
 
virtual void CalculatePassengerOffset (float &x, float &y, float &z, float *o=nullptr) const =0
 This method transforms supplied global coordinates into local offsets. More...
 

Protected Member Functions

 TransportBase ()=default
 
virtual ~TransportBase ()=default
 

Static Protected Member Functions

static void CalculatePassengerPosition (float &x, float &y, float &z, float *o, float transX, float transY, float transZ, float transO)
 
static void CalculatePassengerOffset (float &x, float &y, float &z, float *o, float transX, float transY, float transZ, float transO)
 

Detailed Description

Constructor & Destructor Documentation

◆ TransportBase()

TransportBase::TransportBase ( )
protecteddefault

◆ ~TransportBase()

virtual TransportBase::~TransportBase ( )
protectedvirtualdefault

Member Function Documentation

◆ CalculatePassengerOffset() [1/2]

static void TransportBase::CalculatePassengerOffset ( float &  x,
float &  y,
float &  z,
float *  o,
float  transX,
float  transY,
float  transZ,
float  transO 
)
inlinestaticprotected
131 {
132 if (o)
133 *o = Position::NormalizeOrientation(*o - transO);
134
135 z -= transZ;
136 y -= transY; // y = searchedY * std::cos(o) + searchedX * std::sin(o)
137 x -= transX; // x = searchedX * std::cos(o) + searchedY * std::sin(o + pi)
138 float inx = x, iny = y;
139 y = (iny - inx * std::tan(transO)) / (std::cos(transO) + std::sin(transO) * std::tan(transO));
140 x = (inx + iny * std::tan(transO)) / (std::cos(transO) + std::sin(transO) * std::tan(transO));
141 }
static float NormalizeOrientation(float o)
Definition: Position.h:233

References Position::NormalizeOrientation().

◆ CalculatePassengerOffset() [2/2]

virtual void TransportBase::CalculatePassengerOffset ( float &  x,
float &  y,
float &  z,
float *  o = nullptr 
) const
pure virtual

This method transforms supplied global coordinates into local offsets.

Implemented in Vehicle, and Transport.

Referenced by Vehicle::CalculatePassengerOffset(), and Transport::CalculatePassengerOffset().

◆ CalculatePassengerPosition() [1/2]

static void TransportBase::CalculatePassengerPosition ( float &  x,
float &  y,
float &  z,
float *  o,
float  transX,
float  transY,
float  transZ,
float  transO 
)
inlinestaticprotected
120 {
121 float inx = x, iny = y, inz = z;
122 if (o)
123 *o = Position::NormalizeOrientation(transO + *o);
124
125 x = transX + inx * std::cos(transO) - iny * std::sin(transO);
126 y = transY + iny * std::cos(transO) + inx * std::sin(transO);
127 z = transZ + inz;
128 }

References Position::NormalizeOrientation().

◆ CalculatePassengerPosition() [2/2]

virtual void TransportBase::CalculatePassengerPosition ( float &  x,
float &  y,
float &  z,
float *  o = nullptr 
) const
pure virtual

This method transforms supplied transport offsets into global coordinates.

Implemented in Vehicle, and Transport.

Referenced by Vehicle::CalculatePassengerPosition(), Transport::CalculatePassengerPosition(), MotionTransport::DelayedTeleportTransport(), and MotionTransport::TeleportTransport().