Skip to content

Commit d254ab9

Browse files
committed
Catch exception for emulator tool not being installed
- Try/except for attempting to use the gamepad tool without the program installed. - Added info to readme info for controller emulation - Fixed spelling mistake fixes that would disappoint everyone everywhere.
1 parent fd949a3 commit d254ab9

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

OSCLeash.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from pythonosc.dispatcher import Dispatcher
55
from pythonosc.udp_client import SimpleUDPClient
66
from dataclasses import dataclass
7-
import vgamepad as vg
87
import json
98
import os
109
import sys
@@ -69,8 +68,13 @@ def resource_path(relative_path):
6968
print("Delays of {:.0f}".format(ActiveDelay*1000),"& {:.0f}".format(InactiveDelay*1000),"ms")
7069
#print("Inactive delay of {:.0f}".format(InactiveDelay*1000),"ms")
7170
if XboxJoystickMovement:
72-
gamepad = vg.VX360Gamepad()
73-
print("Emulating Xbox 360 Controller for input instead of OSC")
71+
try:
72+
import vgamepad as vg
73+
gamepad = vg.VX360Gamepad()
74+
print("Emulating Xbox 360 Controller for input instead of OSC")
75+
except Exception as e:
76+
print(e)
77+
print('\x1b[1;31;40m' + 'Tool required for controller emulation not installed. Check the docs.' + '\x1b[0m')
7478

7579
@dataclass
7680
class LeashParameters:

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# OSCLeash
22

3-
Hi, sorry, I swear I'm not a dissapointment to my parents. This is NOT user friendly yet. <br />
3+
Hi, sorry, I swear I'm not a disappointment to my parents. This is NOT user friendly yet. <br />
44
A "simple" system to make a functional "Leash" in VRchat using OSC as an input controller. <br />
55
Could be adapted to any pullable physbone; EG: A tail. <br />
66
If you're smarter and want to improve this code, by all means, PLEASE do so.
@@ -29,7 +29,8 @@ Output those two values back to VRC and boom, you're moving in the direction of
2929

3030
As with RavenBuilds's take on the OSCLeash, using OSC as an input for movement causes you arms to be locked into desktop pose, please slap some support onto this canny! https://feedback.vrchat.com/feature-requests/p/osc-locks-arms
3131

32-
**TEMPORARY WORKAROUND**: Set "XboxJoystickMovement" to true in the config file. Instead of outputting movement with OSC, this will emulate an Xbox controller joystick! Skipping over the above issue enitely. Might break, dunno. This will probably be removed when VRC fixes the issue. You'll hear a little windows connect noise if you've done it right. Make sure to select the VRC window so the inputs are output correctly.
32+
**TEMPORARY WORKAROUND**: Set "XboxJoystickMovement" to true in the config file. Instead of outputting movement with OSC, this will emulate an Xbox controller joystick! Skipping over the above issue enitely. This will probably be removed when VRC fixes the issue. Check the extra steps in setup for this.
33+
3334

3435
##
3536

@@ -55,10 +56,15 @@ Requires VRC3 Avatar SDK.
5556
5. The position constrain source on `Aim Target` should be assigned to the last bone of your leash.
5657
6. If your phybone is off center, copy the constraint from above and paste it on the root of the prefab. The source should be the origin of your leash.
5758
7. Make sure to reset OSC in the radial menu if this is being retrofit as an update to an avatar.
58-
8. Run program & enjoy. If using the temporary xbox input workaround, make sure to select the VRC window.
59+
8. Run program & enjoy.
5960

6061
There will be a setup guide later.
6162

63+
**If using executable with temporary xbox input workaround**
64+
- You need this installed https://github.com/ViGEm/ViGEmBus/releases
65+
- Make sure the VRC window is selected
66+
67+
6268
#
6369

6470
### Config

0 commit comments

Comments
 (0)