VRChat Avatar Setup
What you need
- ShockOSC
- A VRChat avatar
- Basic experience in working with VRChat avatars is recommended
Touch trigger
- Open your avatars unity project.
- Add the Touch Trigger
- Create a new Empty GameObject on the bone you want your trigger to be at, your LeftLeg for example.
- Right-Click the bone.
- Select "Create Empty".
Image
- Select the new GameObject.
- Rename it to whatever you want. For example "ShockOSC"
- Add a new
VRC Contact Receiver
component to it. - Position the object on your avatar.
Image
- Create a new Empty GameObject on the bone you want your trigger to be at, your LeftLeg for example.
-
Configure the VRC Contact Receiver component:
- Radius : That's the range of the trigger, don't make it too big otherwise people will constantly trigger it by accident.
- Filtering:
Local Only
should definitely be used, but it's on you if you useAllow Self
,Allow Others
or both of these. This will decide if other people or you can trigger the shocker by touching it. - Collision Tags: I recommend that you at least use the
Finger
Tag, otherwise people can't touch the trigger with their fingers, but is's up to you what kind of tags you use. - Receiver Type: this needs to be set to
constant
. - Parameter:
ShockOsc/{GroupName}
Replace {GroupName} with the name you gave your shocker in the ShockOSC config.
Example:ShockOsc/leftleg
.
Example
-
Upload your Avatar and you are ready to go! 🎉
Activate OSC
Make sure that you have enabled OSC inside VRChat.
Avatar Update Info
If you update an existing avatar, make sure you delete the OSC config files in C:\Users\%USERPROFILE%\AppData\LocalLow\VRChat\VRChat\OSC
, they are not important for the game since they only hold the avatar parameters for OSC to use, they get regenerated every time you change your avatar, but VRChat fails to update them sometimes when a new parameter got added to an Avatar.
Reload your Avatar after that.
Remote trigger
This will utilize the Contact Sender and Receiver components of the VRChatSDK to make it possible to trigger a shock without touching your Avatar, like a remote.
Create a Receiver
- Open your Avatars Project
- Create a Receiver
- In the Hierarchy right click your Avatar
- Click Create Empty to create a new GameObject
- Rename it to something like "ShockOSC Receiver".
- Select the newly created object and go into the inspector, click on Add Component and add a
VRC Contact Receiver
component to the object.
- Setup the Receiver
- Increase the Range of the component (max. 3m, that's a limit enforced by VRChat)
- Check, Allow Others and Local Only
- Uncheck Allow Self
- Add a Collision Tag
- Set the Collision Tag to Custom
- Set a Custom Tag
- I recommend generating a password with a password generator, don't use a real password! This password needs to be shared with the people that should be able to trigger your receiver.
- Set the receiver type to constant
- Set the Parameter:
ShockOsc/{GroupName}_IShock
(bool), alternatively you can useShockOsc/_All_IShock
(bool) to trigger all your shockers at the same time. Replace {GroupName} with the name you gave your shocker in the ShockOsc config.
Example:ShockOsc/leftleg_IShock
.
Example
Create a Sender
- Open your partners Avatar project.
- Create a Sender
- In the Hierarchy right click your Avatar
- Click Create Empty to create a new GameObject
- Rename it to something like "ShockOSC Sender".
- Select the newly created object and go into the inspector, click on Add Component and add a
VRC Contact Sender
component to the object.
- Setup the Sender
- Increase the Range of the component (max. 3m, that's a limit enforced by VRChat)
- Add a Collision Tag
- Set the Collision Tag to Custom
- Set a Custom Tag
- this needs to be the same tag as the one in the Receiver!
- Create a Toggle for it in the FXLayer.
- Open your Avatar FX Layer Animator
- Go to the Parameter Tab and create a new Bool parameter
- Name the new Bool Parameter however you want, maybe something like "ShockerRemote"
- Switch to the Layer tab of the Animator and Create a new Layer.
- Name the layer something like "Shocker Remote"
- Create 2 new states inside the layer and name them On and Off and set Off as the default layer state (Orange).
- Create 2 new Animations, one that toggles the Sender object On an one that turns it Off, then assigns the animations to the right states you created earlier.
- Create 2 Transitions one from On to Off and one from Off to On.
- Both transitions should not have a transition time greater then 0 and they should have no Exit time.
- In both transitions set your Bool Parameter created earlier as a condition, from On to Off should be
false
and Off to On should betrue
- Create the Toggle in the Action Menu.
- Open your avatars Parameter list and add your earlier created bool parameter to it
- uncheck the "Saved" option and also the "default" option
- Open your Avatar Menu file and go to the place you want to add the Button for the Remote to.
- Create a new entry, give it a name "Shocker Remote" for example. Make sure it's set to Button and then add your Parameter to it.
Upload your Avatars
Important
Both avatars can now be uploaded, the Receiver Avatar should also delete their VRChat OSC config (C:\Users\%USERPROFILE%\AppData\LocalLow\VRChat\VRChat\OSC
) to make sure that the newly added IShock parameter is used by OSC.
Also make sure you have interactions enabled in-game otherwise contacts won't work!
Pull trigger
You can use physbones to trigger shocks with intensity based on the distance the bone is stretched once it's released.
Add a new parameter to a physbone component on your avatar with the same name as your group, e.g. ShockOsc/Leg
or ShockOsc/_All