4#include <mathlib/mathlib.h>
12 AngleVectors(angles, &forward);
31 AngleVectors(angles, &axes.
Forward, &right, &axes.
Up);
39 return origin + axes.
Forward * forwardLeftUp.x + axes.
Left * forwardLeftUp.y + axes.
Up * forwardLeftUp.z;
44 const Vector d = to - from;
45 const float across = std::sqrt(d.x * d.x + d.y * d.y);
51 const float diff = std::fmod(to - from + 180.0f, 360.0f);
52 return (diff < 0.0f ? diff + 360.0f : diff) - 180.0f;
55float TurnToward(
float current,
float target,
float maxStep)
57 return current + std::clamp(
AngleDelta(current, target), -maxStep, maxStep);
QAngle AngleTo(const Vector &from, const Vector &to)
Axes AngleToAxes(const QAngle &angles)
Vector AngleToForward(const QAngle &angles)
Vector YawToForward(float yaw)
float TurnToward(float current, float target, float maxStep)
float AngleDelta(float from, float to)
Vector OffsetLocal(const Vector &origin, const QAngle &angles, const Vector &forwardLeftUp)
constexpr float DegreesPerRadian