-
-
Save KzoNag/be803ea5cef68807b68ea4674e7410d6 to your computer and use it in GitHub Desktop.
ブログ用 - ハンドトラッキングデバイスの追加
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HandDeviceSupport : MonoBehaviour | |
{ | |
private InputDevice _rightDevice, _leftDevice; | |
private void OnEnable() | |
{ | |
_rightDevice = InputSystem.AddDevice<HandDevice>("HandDevice - Right"); | |
if(_rightDevice != null) | |
{ | |
InputSystem.SetDeviceUsage(_rightDevice, CommonUsages.RightHand); | |
} | |
_leftDevice = InputSystem.AddDevice<HandDevice>("HandDevice - Left"); | |
if(_leftDevice != null) | |
{ | |
InputSystem.SetDeviceUsage(_leftDevice, CommonUsages.LeftHand); | |
} | |
} | |
private void OnDisable() | |
{ | |
if(_rightDevice != null && _rightDevice.added) | |
{ | |
InputSystem.RemoveDevice(_rightDevice); | |
_rightDevice = null; | |
} | |
if(_leftDevice != null && _leftDevice.added) | |
{ | |
InputSystem.RemoveDevice(_leftDevice); | |
_leftDevice = null; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment