Core/Object: Added max height change param to MovePosition

(cherry picked from commit 35b8868763)
This commit is contained in:
ModoX
2024-09-21 05:33:30 +02:00
committed by Ovahlord
parent 974fb15360
commit 0e322fdbf4
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -3511,7 +3511,7 @@ void WorldObject::GetContactPoint(WorldObject const* obj, float& x, float& y, fl
GetNearPoint(obj, x, y, z, distance2d, GetAbsoluteAngle(obj));
}
void WorldObject::MovePosition(Position &pos, float dist, float angle) const
void WorldObject::MovePosition(Position &pos, float dist, float angle, float maxHeightChange /*= 6.0f*/) const
{
angle += GetOrientation();
float destx, desty, destz, ground, floor;
@@ -3535,7 +3535,7 @@ void WorldObject::MovePosition(Position &pos, float dist, float angle) const
for (uint8 j = 0; j < 10; ++j)
{
// do not allow too big z changes
if (std::fabs(pos.m_positionZ - destz) > 6)
if (std::fabs(pos.m_positionZ - destz) > maxHeightChange)
{
destx -= step * std::cos(angle);
desty -= step * std::sin(angle);
+1 -1
View File
@@ -505,7 +505,7 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation
void GetNearPoint2D(WorldObject const* searcher, float& x, float& y, float distance, float absAngle) const;
void GetNearPoint(WorldObject const* searcher, float& x, float& y, float& z, float distance2d, float absAngle) const;
void GetClosePoint(float& x, float& y, float& z, float size, float distance2d = 0, float relAngle = 0) const;
void MovePosition(Position &pos, float dist, float angle) const;
void MovePosition(Position &pos, float dist, float angle, float maxHeightChange = 6.0f) const;
Position GetNearPosition(float dist, float angle);
void MovePositionToFirstCollision(Position &pos, float dist, float angle) const;
Position GetFirstCollisionPosition(float dist, float angle);