feat(Core/Movement): added orientation input for Point movement (#3456)

This commit is contained in:
Andrius Peleckas
2020-10-05 12:28:25 +02:00
committed by GitHub
parent 4e9e915a1d
commit be09e03756
4 changed files with 24 additions and 11 deletions

View File

@@ -59,6 +59,12 @@ void PointMovementGenerator<T>::DoInitialize(T* unit)
}
if (speed > 0.0f)
init.SetVelocity(speed);
if (i_orientation > 0.0f)
{
init.SetFacing(i_orientation);
}
init.Launch();
}
@@ -101,6 +107,12 @@ bool PointMovementGenerator<T>::DoUpdate(T* unit, uint32 /*diff*/)
init.MoveTo(i_x, i_y, i_z);
if (speed > 0.0f) // Default value for point motion type is 0.0, if 0.0 spline will use GetSpeed on unit
init.SetVelocity(speed);
if (i_orientation > 0.0f)
{
init.SetFacing(i_orientation);
}
init.Launch();
}

View File

@@ -14,8 +14,8 @@ template<class T>
class PointMovementGenerator : public MovementGeneratorMedium< T, PointMovementGenerator<T> >
{
public:
PointMovementGenerator(uint32 _id, float _x, float _y, float _z, float _speed = 0.0f, const Movement::PointsArray* _path = NULL, bool generatePath = false, bool forceDestination = false) : id(_id),
i_x(_x), i_y(_y), i_z(_z), speed(_speed), _generatePath(generatePath), _forceDestination(forceDestination)
PointMovementGenerator(uint32 _id, float _x, float _y, float _z, float _speed = 0.0f, float orientation = 0.0f, const Movement::PointsArray* _path = nullptr, bool generatePath = false, bool forceDestination = false) : id(_id),
i_x(_x), i_y(_y), i_z(_z), speed(_speed), i_orientation(orientation), _generatePath(generatePath), _forceDestination(forceDestination)
{
if (_path)
m_precomputedPath = *_path;
@@ -37,6 +37,7 @@ class PointMovementGenerator : public MovementGeneratorMedium< T, PointMovementG
uint32 id;
float i_x, i_y, i_z;
float speed;
float i_orientation;
bool i_recalculateSpeed;
Movement::PointsArray m_precomputedPath;
bool _generatePath;