Skip to content

Instantly share code, notes, and snippets.

@nosoop
Created October 21, 2016 06:36
Show Gist options
  • Save nosoop/059c38e40da1c1a686f0225a3501bbb4 to your computer and use it in GitHub Desktop.
Save nosoop/059c38e40da1c1a686f0225a3501bbb4 to your computer and use it in GitHub Desktop.
/**
* Adds another punch angle to the player view.
*
* Equivalent to CBasePlayer::ViewPunch(const QAngle &angleOffset)???
*/
stock void AddPlayerViewPunch(int client, const float vecAngleOffset[3]) {
float vecAnglePlayer[3], vecAngleAdditive[3];
GetEntPropVector(client, Prop_Data, "m_vecPunchAngleVel", vecAnglePlayer);
// (copy angleOffset for modification)
AddVectors(vecAngleOffset, NULL_VECTOR, vecAngleAdditive);
// angleOffset *= 20 (???)
ScaleVector(vecAngleAdditive, 20.0);
// m_vecPunchAngleVel += angleOffset
AddVectors(vecAnglePlayer, vecAngleAdditive, vecAnglePlayer);
SetEntPropVector(client, Prop_Data, "m_vecPunchAngleVel", vecAnglePlayer);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment