View Single Post
Effeff
AlliedModders Donor
Join Date: Jan 2019
Location: discord: ff#0533
Old 03-01-2021 , 19:32   Re: Get direction player is moving relative to other player
Reply With Quote #3

Thanks for your advice.

I currently have this, but I am getting a number in the thousands.

PHP Code:
float GetDamageVelocityModifier(int attackerint victim)
{
    
float attackerPos[3], victimPos[3], unitVec[3], attackerVel[3], attackerNextPos[3], attackerVelVec[3];

    
GetClientAbsOrigin(attackerattackerPos);
    
GetClientAbsOrigin(victimvictimPos);
    
MakeVectorFromPoints(attackerPosvictimPosunitVec);

    
GetEntPropVector(attackerProp_Data"m_vecVelocity"attackerVel);
    
AddVectors(attackerPosattackerVelattackerNextPos);
    
MakeVectorFromPoints(attackerPosattackerNextPosattackerVelVec);

    return 
0.5 GetVectorDotProduct(unitVecattackerVelVec);

I am guessing what I forgot to do is use NormalizeVector somewhere?
Effeff is offline