Гайд Velocity fix

Начинающий
Статус
Оффлайн
Регистрация
22 Сен 2021
Сообщения
37
Реакции[?]
10
Поинты[?]
3K
Код:
 if (previous) {
        if (lag > 0) {
            e->m_vecVelocity() = (current->origin - previous->origin) / TICKS_TO_TIME(lag);
        }
        else
            e->m_vecVelocity() = previous->velocity;


        if (current->flags & FL_ONGROUND) {
            if (current->layers[6].m_flWeight == 0.0f)
                e->m_vecVelocity().Zero();

            float velocity = e->m_vecVelocity().Length2D() / e->GetMaxPlayerSpeed();

            float delta = velocity - current->layers[6].m_flWeight;

            e->m_vecVelocity() *= (1.f - delta);
            e->m_vecVelocity().z = 0.f;
        }
    }
might not be the best code but its better than any the shit code i see on yougame
 
like amiri in my mind
Пользователь
Статус
Оффлайн
Регистрация
4 Дек 2022
Сообщения
308
Реакции[?]
54
Поинты[?]
1K
its proper, nice
 
Последнее редактирование:
Начинающий
Статус
Оффлайн
Регистрация
28 Янв 2023
Сообщения
10
Реакции[?]
6
Поинты[?]
0
Код:
 if (previous) {
        if (lag > 0) {
            e->m_vecVelocity() = (current->origin - previous->origin) / TICKS_TO_TIME(lag);
        }
        else
            e->m_vecVelocity() = previous->velocity;


        if (current->flags & FL_ONGROUND) {
            if (current->layers[6].m_flWeight == 0.0f)
                e->m_vecVelocity().Zero();

            float velocity = e->m_vecVelocity().Length2D() / e->GetMaxPlayerSpeed();

            float delta = velocity - current->layers[6].m_flWeight;

            e->m_vecVelocity() *= (1.f - delta);
            e->m_vecVelocity().z = 0.f;
        }
    }
might not be the best code but its better than any the shit code i see on yougame
useless. and wrong
proper impn from onetap v5

C++:
// only on ground and if have m_vecVelocity.
if ( LagRecord->m_nFlags & SDK::Enums::Flags::FL_ONGROUND && LagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].m_flWeight > 0.0 && LagRecord->m_vecVelocity( ).Length( ) >= 0.1 )
{
    // compare animation layer movement move flWeight.
    if ( LagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].m_flWeight == PreviousLagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].m_flWeight )
    {
        // compare for animation layer movement move flWeight sucessfully done.
        // now compare animation layer movement move nSequence.
        if ( LagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].nSequence == PreviousLagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].nSequence )
        {
            // compare for animation layer movement move nSequence sucessfully done.
            // now check for landing animation flWeight.
            if ( LagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_LAND_OR_CLIMB ].m_flWeight == PreviousLagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_LAND_OR_CLIMB ].m_flWeight )
            {
                // compare for landing animation flWeight sucessfully done.
                // get max speed.
                auto flMaxSpeed = g_Globals->GetActiveWeapon ? std::max( 0.1f, g_Globals->GetActiveWeapon->GetMaxSpeed( ) ) : 260.0f;
               
                // fuck my brain.
                if ( flMaxSpeed >= 0.1f )
                {
                    // get m_flSpeedAsPortionOfRunTopSpeed.
                    auto flSpeedAsPortionOfRunTopSpeed = 0.55f - ( LagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].m_flWeight - 1.0f ) / LagRecord->m_vecVelocity( ).Length( );
                   
                    // check flWeight if not out of bounds.
                    if ( LagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].m_flWeight > 0.0 && LagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].m_flWeight < 1.0 )
                    {
                        // check flSpeedAsPortionOfRunTopSpeed values.
                        if ( flSpeedAsPortionOfRunTopSpeed > 0.1 && flSpeedAsPortionOfRunTopSpeed < 0.9 )
                        {
                            // set m_vecVelocity.
                            LagRecord->m_vecVelocity( ).x *= flSpeedAsPortionOfRunTopSpeed;
                            LagRecord->m_vecVelocity( ).y *= flSpeedAsPortionOfRunTopSpeed;
                        }
                    }
                }
            }
        }
    }
}
 
Последнее редактирование:
like amiri in my mind
Пользователь
Статус
Оффлайн
Регистрация
4 Дек 2022
Сообщения
308
Реакции[?]
54
Поинты[?]
1K
useless. and wrong
proper impn from onetap v5

C++:
// only on ground and if have m_vecVelocity.
if ( LagRecord->m_nFlags & SDK::Enums::Flags::FL_ONGROUND && LagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].m_flWeight > 0.0 && LagRecord->m_vecVelocity( ).Length( ) >= 0.1 )
{
    // compare animation layer movement move flWeight.
    if ( LagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].m_flWeight == PreviousLagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].m_flWeight )
    {
        // compare for animation layer movement move flWeight sucessfully done.
        // now compare animation layer movement move nSequence.
        if ( LagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].nSequence == PreviousLagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].nSequence )
        {
            // compare for animation layer movement move nSequence sucessfully done.
            // now check for landing animation flWeight.
            if ( LagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_LAND_OR_CLIMB ].m_flWeight == PreviousLagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_LAND_OR_CLIMB ].m_flWeight )
            {
                // compare for landing animation flWeight sucessfully done.
                // get max speed.
                auto flMaxSpeed = g_Globals->GetActiveWeapon ? std::max( 0.1f, g_Globals->GetActiveWeapon->GetMaxSpeed( ) ) : 260.0f;
              
                // fuck my brain.
                if ( flMaxSpeed >= 0.1f )
                {
                    // get m_flSpeedAsPortionOfRunTopSpeed.
                    auto flSpeedAsPortionOfRunTopSpeed = 0.55f - ( LagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].m_flWeight - 1.0f ) / LagRecord->m_vecVelocity( ).Length( );
                  
                    // check flWeight if not out of bounds.
                    if ( LagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].m_flWeight > 0.0 && LagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].m_flWeight < 1.0 )
                    {
                        // check flSpeedAsPortionOfRunTopSpeed values.
                        if ( flSpeedAsPortionOfRunTopSpeed > 0.1 && flSpeedAsPortionOfRunTopSpeed < 0.9 )
                        {
                            // set m_vecVelocity.
                            LagRecord->m_vecVelocity( ).x *= flSpeedAsPortionOfRunTopSpeed;
                            LagRecord->m_vecVelocity( ).y *= flSpeedAsPortionOfRunTopSpeed;
                        }
                    }
                }
            }
        }
    }
}
thats v5.1 pre-alpha bro dont lie
 
Начинающий
Статус
Оффлайн
Регистрация
22 Сен 2021
Сообщения
37
Реакции[?]
10
Поинты[?]
3K
useless. and wrong
proper impn from onetap v5

C++:
// only on ground and if have m_vecVelocity.
if ( LagRecord->m_nFlags & SDK::Enums::Flags::FL_ONGROUND && LagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].m_flWeight > 0.0 && LagRecord->m_vecVelocity( ).Length( ) >= 0.1 )
{
    // compare animation layer movement move flWeight.
    if ( LagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].m_flWeight == PreviousLagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].m_flWeight )
    {
        // compare for animation layer movement move flWeight sucessfully done.
        // now compare animation layer movement move nSequence.
        if ( LagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].nSequence == PreviousLagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].nSequence )
        {
            // compare for animation layer movement move nSequence sucessfully done.
            // now check for landing animation flWeight.
            if ( LagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_LAND_OR_CLIMB ].m_flWeight == PreviousLagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_LAND_OR_CLIMB ].m_flWeight )
            {
                // compare for landing animation flWeight sucessfully done.
                // get max speed.
                auto flMaxSpeed = g_Globals->GetActiveWeapon ? std::max( 0.1f, g_Globals->GetActiveWeapon->GetMaxSpeed( ) ) : 260.0f;
             
                // fuck my brain.
                if ( flMaxSpeed >= 0.1f )
                {
                    // get m_flSpeedAsPortionOfRunTopSpeed.
                    auto flSpeedAsPortionOfRunTopSpeed = 0.55f - ( LagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].m_flWeight - 1.0f ) / LagRecord->m_vecVelocity( ).Length( );
                 
                    // check flWeight if not out of bounds.
                    if ( LagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].m_flWeight > 0.0 && LagRecord->m_nLayers[ SDK::Enums::AnimationLayers::ANIMATION_LAYER_MOVEMENT_MOVE ].m_flWeight < 1.0 )
                    {
                        // check flSpeedAsPortionOfRunTopSpeed values.
                        if ( flSpeedAsPortionOfRunTopSpeed > 0.1 && flSpeedAsPortionOfRunTopSpeed < 0.9 )
                        {
                            // set m_vecVelocity.
                            LagRecord->m_vecVelocity( ).x *= flSpeedAsPortionOfRunTopSpeed;
                            LagRecord->m_vecVelocity( ).y *= flSpeedAsPortionOfRunTopSpeed;
                        }
                    }
                }
            }
        }
    }
}
can u explain how that is any different from mine? it just has some extra useless checks
......
and what is bad about it exactly????
its just trying to get the velocity as close as possible to the animation layer
 
like amiri in my mind
Пользователь
Статус
Оффлайн
Регистрация
4 Дек 2022
Сообщения
308
Реакции[?]
54
Поинты[?]
1K
Сверху Снизу