Skip to content

Conversation

@tsuza
Copy link

@tsuza tsuza commented Mar 5, 2023

Changing the player's class to the intended weapon's class and then reverting it back is not required to have correct animations. The missing piece was setting the weapon's m_iViewModelIndex.

Copy link
Owner

@FortyTwoFortyTwo FortyTwoFortyTwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly is there fixed from current? Is it just setting m_iViewModelIndex correctly as intended?

ViewModels_UpdateArms(iClient, iWeapon); // Set arms for the weapon were about to equip

//Change class before equipping the weapon, otherwise anims and reload times are odd
SetClientClass(iClient, TF2_GetDefaultClassFromItem(iWeapon));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix was added before the whole viewmodel update. While most anims and reload times does seems to have fixed itself from the update, It's however still needed for the first draw animation (along with ViewModels_UpdateArms in this hook). Comment could've been updated to reflect this current situation, or whenever if there is another solution to fix this without needing a class change.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see any changes after removing it. Any weapons in particular that get affected by it?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any weapons, only happens when switching to it for the first time.

2023-03-05.18-51-57.mp4

@tsuza
Copy link
Author

tsuza commented Mar 5, 2023

Maybe I should have given a better title to the PR. Yes, viewmodels currently work just fine. However:
Setting the weapon's model and setting the weapon's m_iViewModelIndex on top of setting m_nCustomViewmodelModelIndex removes the need to:

  • Set the player's m_hViewModel model.
  • Change the class before and after SDKHook_WeaponEquip ( the issue in this line gets fixed by setting m_iViewModelIndex ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants