okay thanks i will try
and i have find this code which do exactly what i wanted but problem is it is in module coding and i don't know how to apply in plugin . any way i will try your method
PHP Code:
if (m_vecCurAngles.y != m_vecGoalAngles.y)
{
float flDir = m_vecGoalAngles.y > m_vecCurAngles.y ? 1 : -1 ;
float flDist = fabs(m_vecGoalAngles.y - m_vecCurAngles.y);
if (flDist > 180)
{
flDist = 360 - flDist;
flDir = -flDir;
}
if (flDist > 30)
{
if (m_fTurnRate < m_iBaseTurnRate * 10)
{
m_fTurnRate += m_iBaseTurnRate;
}
}
else if (m_fTurnRate > 45)
{
m_fTurnRate -= m_iBaseTurnRate;
}
else
{
m_fTurnRate += m_iBaseTurnRate;
}
m_vecCurAngles.y += 0.1 * m_fTurnRate * flDir;
if (m_vecCurAngles.y < 0)
m_vecCurAngles.y += 360;
else if (m_vecCurAngles.y >= 360)
m_vecCurAngles.y -= 360;
if (flDist < (0.05 * m_iBaseTurnRate))
m_vecCurAngles.y = m_vecGoalAngles.y;
//ALERT(at_console, "%.2f -> %.2f\n", m_vecCurAngles.y, y);
if (m_iOrientation == 0)
SetBoneController(0, m_vecCurAngles.y - pev->angles.y );
else
SetBoneController(0, pev->angles.y - 180 - m_vecCurAngles.y );
state = 1;
}
FULL LINK :-
https://github.com/ValveSoftware/hal...lls/turret.cpp
__________________