Core/Movement
* Implemented creature movement on transports * Set minimum speed for creature allowed to start movement (too low speed leads to overflows in movement time calculations which in turn leads to crashes)
This commit is contained in:
@@ -33,6 +33,17 @@ namespace Movement
|
||||
FlyToGround = 3, // 463 = FlyToGround
|
||||
};
|
||||
|
||||
// Transforms coordinates from global to transport offsets
|
||||
class TransportPathTransform
|
||||
{
|
||||
public:
|
||||
TransportPathTransform(Unit& owner) : _owner(owner) { }
|
||||
Vector3 operator()(Vector3 input);
|
||||
|
||||
private:
|
||||
Unit& _owner;
|
||||
};
|
||||
|
||||
/* Initializes and launches spline movement
|
||||
*/
|
||||
class MoveSplineInit
|
||||
@@ -123,14 +134,15 @@ namespace Movement
|
||||
inline void MoveSplineInit::SetSmooth() { args.flags.EnableCatmullRom();}
|
||||
inline void MoveSplineInit::SetCyclic() { args.flags.cyclic = true;}
|
||||
inline void MoveSplineInit::SetFall() { args.flags.EnableFalling();}
|
||||
inline void MoveSplineInit::SetVelocity(float vel){ args.velocity = vel;}
|
||||
inline void MoveSplineInit::SetVelocity(float vel) { args.velocity = vel; args.HasVelocity = true; }
|
||||
inline void MoveSplineInit::SetOrientationInversed() { args.flags.orientationInversed = true;}
|
||||
inline void MoveSplineInit::SetOrientationFixed(bool enable) { args.flags.orientationFixed = enable;}
|
||||
|
||||
inline void MoveSplineInit::MovebyPath(const PointsArray& controls, int32 path_offset)
|
||||
{
|
||||
args.path_Idx_offset = path_offset;
|
||||
args.path.assign(controls.begin(),controls.end());
|
||||
args.path.resize(controls.size());
|
||||
std::transform(controls.begin(), controls.end(), args.path.begin(), TransportPathTransform(unit));
|
||||
}
|
||||
|
||||
inline void MoveSplineInit::MoveTo(float x, float y, float z)
|
||||
@@ -139,13 +151,6 @@ namespace Movement
|
||||
MoveTo(v);
|
||||
}
|
||||
|
||||
inline void MoveSplineInit::MoveTo(const Vector3& dest)
|
||||
{
|
||||
args.path_Idx_offset = 0;
|
||||
args.path.resize(2);
|
||||
args.path[1] = dest;
|
||||
}
|
||||
|
||||
inline void MoveSplineInit::SetParabolic(float amplitude, float time_shift)
|
||||
{
|
||||
args.time_perc = time_shift;
|
||||
|
||||
Reference in New Issue
Block a user