mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 10:28:26 +00:00
make prespeed_ez_vel work with just angles too
This commit is contained in:
parent
525b62753b
commit
98ee179927
@ -1297,15 +1297,23 @@ public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float
|
|||||||
GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", fSpeed);
|
GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", fSpeed);
|
||||||
float fSpeedXY = (SquareRoot(Pow(fSpeed[0], 2.0) + Pow(fSpeed[1], 2.0)));
|
float fSpeedXY = (SquareRoot(Pow(fSpeed[0], 2.0) + Pow(fSpeed[1], 2.0)));
|
||||||
|
|
||||||
|
if (fSpeedXY < prespeed_ez_vel)
|
||||||
|
{
|
||||||
|
float theta;
|
||||||
|
|
||||||
if (fSpeedXY >= 1.0)
|
if (fSpeedXY >= 1.0)
|
||||||
{
|
{
|
||||||
float direction[3];
|
float direction[3];
|
||||||
GetVectorAngles(fSpeed, direction);
|
GetVectorAngles(fSpeed, direction);
|
||||||
|
theta = DegToRad(direction[1]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
theta = DegToRad(angles[1]);
|
||||||
|
}
|
||||||
|
|
||||||
float yaw = DegToRad(direction[1]);
|
fSpeed[0] = prespeed_ez_vel * Cosine(theta);
|
||||||
fSpeed[0] = prespeed_ez_vel * Cosine(yaw);
|
fSpeed[1] = prespeed_ez_vel * Sine(theta);
|
||||||
fSpeed[1] = prespeed_ez_vel * Sine(yaw);
|
|
||||||
|
|
||||||
DumbSetVelocity(client, fSpeed);
|
DumbSetVelocity(client, fSpeed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user