|
Table of Contents
|
part of World Components
VRC_OSC Button In
The "Osc Button In" component allows you to receive OpenSoundControl messages and execute custom triggers from them. It is meant to make your world interactive, using any OSC compatible software.
Address
Note: This does not mean a protocol address, like the IP address, but simply a namespace address.
The address needs to be formatted in a specific way starting with a forward slash ("/") followed by any namespace. This can be repeated multiple times for sub-namespaces. (example: "/test" or "/test/trigger1").
On Button On / On Button Off
When an OSC message with the matching address is received, stating that the "button" (this might reference to an actual "physical" button, but doesnt have to) has been pressed, the VRC_Trigger will execute the custom trigger, specified in the "On Button On" field. Same applies for the "On Button Off" field, when a message with the matching address is received, stating that the "button" has been released.
When using a programmatic approach to simulate button presses, use float 1.0 to represent "On" and float 0.0 to represent "Off". Using bool True and bool False appears to be generate errors in the VRChat output log. To simulate a button press "On" then "Off" you must code an artificial delay or the system will be unstable and the events may not fire if you press the button again in the future.
Setup
To set this up, the software using OSC will have to send the UDP packet to the users IP address that the button should be pressed on. This however requires some knowledge about networking and internet data transmission. If you send the message via software that runs on your own computer (an example of this would be using Python with the pythonosc plugin) you will want to press it locally and simply use the localhost address "127.0.0.1". The port the VRChat client listens on for OSC messages is (and must therefore be set to) 9000.
Depending on the way the software handles OSC messaging, arguments for if the "button" is pressed or released, may have to be set manually (as 1 for being pressed and 0 for not being pressed / being released).
A button must always be pressed to be released, and must be be released to be pressed. This means that you cannot send multiple messages that would press the button without releasing the button each time.
If you don't want to execute a custom trigger when the button is released, you should not simply leave the "On Button Off" field empty, but still assign a VRC_Trigger with a custom trigger that does nothing to avoid null reference exceptions. (Same applies when you only want to trigger something when the button is released)
Resources
- Python, python-osc
- C#, OSCforPCL (also available on NuGet)
- Go, go-osc (used in VRC_OSC_Bridge)