View Single Post
Author Message
Phil25
AlliedModders Donor
Join Date: Feb 2015
Old 10-06-2018 , 14:20   [TF2/L4D*/?] [SNIPPET] Smoothly turning players
Reply With Quote #1

I've found that view punch works really well with rotating the player because of its instant effect and smoothing towards the actual player view.

Applying it in the other direction, on the same frame, produces smooth turning effect with a little bit of wobbling at the end if the angle is wide enough. This only works in first person, other players just see the client spazzing about.

PHP Code:
stock void RotateClientSmooth(int clientfloat fAngle){
    
float fPunch[3], fEyeAng[3];
    
GetClientEyeAngles(clientfEyeAng);

    
fEyeAng[1] -= fAngle;
    
fPunch[1] += fAngle;

    
TeleportEntity(clientNULL_VECTORfEyeAngNULL_VECTOR);
    
SetEntPropVector(clientProp_Send"m_vecPunchAngle"fPunch);

PHP Code:
RotateClientSmooth(client30.0); // turns client 30 degrees to right 
I don't know if m_vecPunchAngle is available for mods other than TF2.

Last edited by Phil25; 10-07-2018 at 00:58.
Phil25 is offline