mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 09:17:36 +01:00
Core/Movement: implement cyclic path motion master helper to allow creatures to move along hardcoded spline points that are perfect circles
This commit is contained in:
@@ -512,6 +512,32 @@ void MotionMaster::MoveCirclePath(float x, float y, float z, float radius, bool
|
||||
init.Launch();
|
||||
}
|
||||
|
||||
void MotionMaster::MoveCyclicPath(Position const* pathPoints, size_t pathSize, bool walk /*= false*/, bool fly /*= false*/, float velocity /*= 0.0f*/)
|
||||
{
|
||||
Movement::MoveSplineInit init(_owner);
|
||||
Movement::PointsArray path;
|
||||
path.reserve(pathSize);
|
||||
std::transform(pathPoints, pathPoints + pathSize, std::back_inserter(path), [](Position const& point)
|
||||
{
|
||||
return G3D::Vector3(point.GetPositionX(), point.GetPositionY(), point.GetPositionZ());
|
||||
});
|
||||
|
||||
if (fly)
|
||||
{
|
||||
init.SetFly();
|
||||
init.SetUncompressed();
|
||||
}
|
||||
|
||||
if (velocity > 0.0f)
|
||||
init.SetVelocity(velocity);
|
||||
|
||||
init.MovebyPath(path);
|
||||
init.SetSmooth();
|
||||
init.SetWalk(walk);
|
||||
init.SetCyclic();
|
||||
init.Launch();
|
||||
}
|
||||
|
||||
void MotionMaster::MoveSmoothPath(uint32 pointId, Position const* pathPoints, size_t pathSize, bool walk /*= false*/, bool fly /*= false*/, float velocity /*= 0.0f*/)
|
||||
{
|
||||
Movement::MoveSplineInit init(_owner);
|
||||
|
||||
@@ -185,6 +185,7 @@ class TC_GAME_API MotionMaster
|
||||
}
|
||||
void MoveJump(float x, float y, float z, float o, float speedXY, float speedZ, uint32 id = EVENT_JUMP, bool hasOrientation = false);
|
||||
void MoveCirclePath(float x, float y, float z, float radius, bool clockwise, uint8 stepCount);
|
||||
void MoveCyclicPath(Position const* pathPoints, size_t pathSize, bool walk = false, bool fly = false, float velocity = 0.0f);
|
||||
void MoveSmoothPath(uint32 pointId, Position const* pathPoints, size_t pathSize, bool walk = false, bool fly = false, float velocity = 0.0f);
|
||||
// Walk along spline chain stored in DB (script_spline_chain_meta and script_spline_chain_waypoints)
|
||||
void MoveAlongSplineChain(uint32 pointId, uint16 dbChainId, bool walk);
|
||||
|
||||
Reference in New Issue
Block a user