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:
Ovahlord committed 2019-10-05 06:30:55 +02:00
1 parent 393664186a
commit e135d35551
2 files changed
+27

No files matched your search

+26
View File
@@ -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);