VRCInputMethod and OnInputMethodChanged() needs an update in the SDK. I also have a workaround.
Log In
DrakenStark
Presently Embodied isn't listed as an InputMethod in the SDK, but it does currently exist as 19 within VRChat's client.
Furthermore, while Embodied is the current input method, OnInputMethodChanged() is called every frame instead of just once at the start of the use of that input method.
Beyond even that, either hand tracking or Embodied does not set IsUsingHandController() to true and there is not an IsUsingHandTracking() equivalent.
Current and Latest version as of this post: 3.8.2
I currently have a work around available:
[SerializedField] private bool _leftHand = true;
private bool _firstFrameOfInputOnly = true;
private int _lastInputMethod = -1;
private VRCPlayerApi _player = null;
private void OnEnable()
{
_player = Networking.GetOwner(gameObject);
}
public override void OnInputMethodChanged(VRCInputMethod inputMethod)
{
if (_player.isLocal)
{
//It is annoying to have more spam than necessary, so _leftHand optimally should ensure only one Input Method Changed is logged in console.
if (_leftHand && _firstFrameOfInputOnly)
{
_firstFrameOfInputOnly = false;
Debug.LogWarning("Input Method Changed to: " + inputMethod + " (" + ((int)inputMethod) + ")", gameObject);
}
if (_lastInputMethod != (int)inputMethod)
{
_firstInputFrame = true;
_lastInputMethod = (int)inputMethod;
}
bool handTracking = false;
switch ((int)inputMethod)
{
case 13: //VRCInputMethod.QuestHands:
{
handTracking = true;
break;
}
case 19: //VRCInputMethod.Embodied:
{
handTracking = true;
break;
}
}
if (InputManager.IsUsingHandController() || handTracking)
{
//Debug.LogWarning("Hand Controllers detected.", gameObject);
if (_leftHand) { _sbRaySpawn._setTracking(1); }
else { _sbRaySpawn._setTracking(2); }
}
else
{
_sbRaySpawn._setTracking(0); //Debug.LogWarning("Something other than Hand Controllers was detected.", gameObject);
}
}
}
DrakenStark
This was discovered as I'm currently in the process of replacing/enhancing the currrent Interact and Pickup systems.
I'm using an interact that reports the point where the RayCast hits as the Input Use event is called. (Snowballs can be spawned anywhere where the RayCast hits an assigned Layer, including other snowballs for catching them.)
Continuous sync is only used while a snowball is held, switching to manual sync after both being dropped and exiting the local player's own collision. This allows for local physics to handle the rest instead of skipping across the air with continuous and higher network latency. With local physics, snowballs flow in a proper arc and can more easily be predicted, allowing for catching and dodging.
Snowballs are using RayCasting for detecting player collision on the UI layer, making it performant. Replacement hitboxes aren't performant, implemented natively, or synced accurately with ease.
I have found a lot of inaccuracy with ClientSim while developing this. lol