How to Install - RuneFox237/VRChat-PunchingSystem GitHub Wiki
Warning: At the moment adding the Punching system will require a decent understanding of VRChat Avatar creation as you will need to do a number of things manually to get the system working.
Tools needed:
Not necessary, but nice to have tools:
- hfcRed's Animation Repathing tool - Helps fix animations that may have broken when you move objects around the hierarchy
The Punching system requires the VRLabs Ragdoll system to be installed onto the avatar first as it builds off of/modifies parts of that system. If you want to add sounds on collisons/ragdolling later make sure to check the boxes on the script here otherwise it won't generate the additional systems. I would also recommend making a copy of your FX layer, Expressions Menu, and Parameters as the Ragdoll System will add extra layers and parameters to your animator which you may not want on your other avatars if they use the same FX layer.
Note: Due to the punching system currently modifying key parts of the Ragdoll system normal use of the system may not function the way it normally does.
If you would like a video walkthrough one is located here:
https://www.youtube.com/watch?v=bsFWOlppUto
Step 1: Import the Package
Download the latest release from the release section of this GitHub or the Gumroad and import the unity package like any other package
Step 2: Add and Unpack the prefab
Find the 'PunchSystem' Prefab in the Prefabs sub-folder of the PunchSystem folder and drag it into your hierarchy as a child of your avatar. Right Click the prefab and click 'unpack prefab'
Step 3: Moving Objects
Drag Head Target to become a child of the Head of the avatar Drag Chest Target to become a child of the Chest It's also a good idea to set the xyz position values to 0. Scale and Rotation can be left alone depending on the avatar.
Step 4: Adjusting Contacts
The contacts may be too big or too small for your avatar or too close/too far. You can edit these in a couple of ways:
- If the contact cluster is too low/high you can move the Target objects you added to the armature in the previous step up and down.
- If the contacts are too small/large, you can change the Scale of the Target objects to change the size of the contacts.
- You can also change the settings in the contacts themselves, though that will be a tedious task as there are 18 contacts. This may be required if you want to get extra height out of the capsules while keeping the radius small by changing them to capsules.
I would recommend going as small as you can, as the larger the contact, the harder it may be for people to activate the contacts properly, especially on larger avatars.
Step 5: Merge Animator and Parameters
Merge the Punchable FX animator and Parameters using Avatars 3.0 Manager When Merging Animators make sure to remove the 0 suffix from Ragdoll so that it properly merges with the already existing parameter. This will probably happen to the 'Ragdoll' and 'Ragdoll.Trigger' parameters. Make sure to delete everything in the fields there as it is a ' 0' (with a space) and not just a '0'
(Note: The image above may look different from what your animator/parameters might look like as I was using an older version of the Ragdoll System at the time but it should work the same)
Step 6: Change the RagdollVelocity Layer
In your FX animator there should be a layer generated by the Ragdoll system called RagdollVelocity. Inside this layer is a state called 'Blend Velocity'. Replace the blendtree in there with the 'VelocityBlendTree' blend tree located in the PunchableSystem/Animations folder.
Step 7: Add the HeadSnap Particle system to the Ragdoll On and Off animations
Look for the 'Ragdoll Main' layer in your FX layer and find the 'Ragdoll' and 'Ragdoll, statue off' animations. You'll need to add keyframes to these animations for enabling/disabling the ColliderParticle GameObject which is responsible for making the head of the avatar react like it was punched when hit.
Note: I recommend making a copy of each of these animations to make these edits to in order to preserve the old animation in case something goes wrong. (selecting an asset like an animation in the Unity Project folder and hitting Ctrl+d duplicates the asset.)
I would also recommend checking the vertical position of the HeadSnap particle to make sure it's correctly aimed at the head as it may not be in the right position for some models. You'll need to enable both the buffer and particle objects to see the particle system gizmo, just remember to disable them again afterwards
Step 8: Change Some Values on the Ragdoll Rigidbody
Navigate to the Rigidbodies object within the Ragdoll System container and find the Velocity object there. On the Configurable Joint Component on the Velocity Object look for the Angular X and Angular YZ Drives. There's going to be a field labeled Position Damper on each of these. Set that to 0.5. This will let the rotation actually work on head contact so the avatar full scorpions properly
Step 9: Add the Punchable System Menu to your Avatar Menu
Add a sub-menu control to the Avatar's expression menu and give it the 'Punch System Menu - Main' submenu located in the PunchSystem Folder.
If you run into any issues or have any additional questions, feel free to message me on Discord at runefox237. It may take me a while to respond. I may also be making a discord server to help with handling questions at a later date. I will update this footnote if this happens.