Here's where the bug is:  in PM_Accelerate, the calculation of currentspeed
is wrong, which causes addspeed to be too high, leading to a velocity after
acceleration greater than maxspeed.  This only happens when the direction of
your movement commands differs from the direction you're actually moving
(such as moving diagonally into a wall).  The original statement is:

currentspeed = DotProduct(pmove->velocity, wishdir);

As you all know, speed is sqrt(x^2 + y^2 + z^2).

Changing the above statement to one of the following fixes it:

currentspeed = sqrt(pmove->velocity[0]*pmove->velocity[0] +
pmove->velocity[1]*pmove->velocity[1] +
pmove->velocity[2]*pmove->velocity[2]);

or the equivalent but easier to type:

currentspeed = sqrt(DotProduct(pmove->velocity, pmove->velocity);

Jim



_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to