mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-21 20:56:23 +00:00
fix(Core/Spells): updates trajectory target selection (#23031)
Co-authored-by: xinef1 <w.szyszko2@gmail.com>
This commit is contained in:
@@ -41,10 +41,17 @@ void Position::RelocatePolarOffset(float angle, float dist, float z /*= 0.0f*/)
|
||||
}
|
||||
|
||||
bool Position::HasInLine(Position const* pos, float width) const
|
||||
{
|
||||
return HasInLine(pos, 0, width);
|
||||
}
|
||||
|
||||
bool Position::HasInLine(Position const* pos, float objSize, float width) const
|
||||
{
|
||||
if (!HasInArc(float(M_PI), pos))
|
||||
return false;
|
||||
|
||||
width += objSize;
|
||||
|
||||
float angle = GetRelativeAngle(pos);
|
||||
return std::fabs(std::sin(angle)) * GetExactDist2d(pos->GetPositionX(), pos->GetPositionY()) < width;
|
||||
}
|
||||
|
||||
@@ -231,6 +231,7 @@ struct Position
|
||||
[[nodiscard]] bool IsWithinBox(const Position& center, float xradius, float yradius, float zradius) const;
|
||||
bool HasInArc(float arcangle, const Position* pos, float targetRadius = 0.0f) const;
|
||||
bool HasInLine(Position const* pos, float width) const;
|
||||
bool HasInLine(Position const* pos, float objSize, float width) const;
|
||||
[[nodiscard]] std::string ToString() const;
|
||||
|
||||
// modulos a radian orientation to the range of 0..2PI
|
||||
|
||||
Reference in New Issue
Block a user