/
AimbotSmoother.h
41 lines (33 loc) · 919 Bytes
/
AimbotSmoother.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once
class AimbotSmoother
{
public:
AimbotSmoother();
void Update(float DeltaTime);
void ResetTimes(SM::Vector2& Times);
void SmoothAngles(SM::Vector2& CurrentAngles, SM::Vector2& TargetAngles);
private:
SM::Vector2 m_TimeToTarget;
SM::Vector2 m_CurAimTime;
};
AimbotSmoother::AimbotSmoother()
{
}
void AimbotSmoother::Update(float DeltaTime)
{
m_CurAimTime += SM::Vector2(DeltaTime, DeltaTime);
if(m_CurAimTime.x > m_TimeToTarget.x)
m_CurAimTime.x = m_TimeToTarget.x;
if(m_CurAimTime.y > m_TimeToTarget.y)
m_CurAimTime.y = m_TimeToTarget.y;
}
void AimbotSmoother::ResetTimes(SM::Vector2& NewAimTimes)
{
m_TimeToTarget = NewAimTimes;
m_CurAimTime = SM::Vector2(0, 0);
}
void AimbotSmoother::SmoothAngles(SM::Vector2& CurrentAngles,SM::Vector2& TargetAngles)
{
SM::Vector2 AimPercent = m_CurAimTime / m_TimeToTarget;
CerpAngle(CurrentAngles, TargetAngles, AimPercent.x, AimPercent.y);
}