Thread: m_flFriction
View Single Post
diablix
Senior Member
Join Date: Jan 2010
Location: Warsaw, Poland
Old 09-04-2015 , 15:05   Re: m_flFriction
Reply With Quote #4

I know it's been a while but since the people are still asking about it here is how I did it.
I decided to simulate on-ice effect, this is the closest effect to the real friction I could achieve:

PHP Code:
new g_bOnIce[MAXPLAYERS+1];

public 
setIceFeeling(iClientiOnIce=1g_bOnIce[iClient] = bool:iOnIce;

public 
OnGameFrame(){
    for(new 
<= MaxClients i++){
        if(
g_bOnIce[i] &&  IsClientInGame(i) && IsPlayerAlive(i)){
            if(
GetEntityFlags(i) & FL_ONGROUND){
                new 
Float:fVel[3], Float:fJak;
                
Entity_GetAbsVelocity(ifVel);
                
fVel[2] = 0.0;
                new 
Float:fSpeed GetVectorLength(fVel);
                
                
fJak = (fSpeed/266.0) * 100;
                
                
GetEntPropVector(iProp_Data"m_vecVelocity"fVel);
                
                for(new 
l++){
                    
fVel[l] += (fVel[l]/fJak);
                }
                
                
TeleportEntity(iNULL_VECTORNULL_VECTORfVel);
            }
        }
    }

diablix is offline
Send a message via Skype™ to diablix