What's new

Welcome to HvH Forum!

SignUp Now! Download Free HvH CS2/CS:GO Cheats, CFG, LUA/JS Scripts, And More!


SignUp Now!

Source Code Entity velocity fix

Administrator
User ID
1097
Messages
149
Reactions
232
Level
57
Hey,
You might know that entity velocity is not networked in the game, this means that the netvar for velocity is just calculating it over the last 2 positions of the player.
Maybe you already spotted the issue, what if the velocity is off, while were using it for resolving, prediction or extrapolation? Tough shit.

Lucky for us we can do a very easy fix to increase the accuracy for lots of things when the player suddenly stops moving using layer 6.
C++:
 float feetcycle_playback_rate = data.player[entity->index()].networked_layers[6].playbackRate;
        if (feetcycle_playback_rate == 0.f) {
            entity->velocity().x = 0.f;
            entity->velocity().y = 0.f;
        }

This detects by the animation layer if the player is moving at all, if not then we set the velocity on the X and Y axis to 0 so we do not mispredict them.

You could go a step further and get the velocityXY from the animationcode by literally reversing the code.

More info:
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Top