Skip to content

Instantly share code, notes, and snippets.

@KzoNag
Created December 14, 2022 11:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KzoNag/4cddb6e7cf8d2da46660b1ba2ed0b849 to your computer and use it in GitHub Desktop.
Save KzoNag/4cddb6e7cf8d2da46660b1ba2ed0b849 to your computer and use it in GitHub Desktop.
ブログ用 - ハンドトラッキングの入力状態定義
[StructLayout(LayoutKind.Explicit, Size = 38)]
public struct HandDeviceState : IInputStateTypeInfo
{
public FourCC format => new FourCC('P', 'C', 'H', 'D');
[InputControl(usage = "TrackingState", layout = "Integer", offset = 0)]
[FieldOffset(0)]
public int trackingState;
[InputControl(usage = "IsTracked", layout = "Button", offset = 4)]
[FieldOffset(4)]
public bool isTracked;
[InputControl(usage = "DevicePosition", offset = 5)]
[FieldOffset(5)]
public Vector3 devicePosition;
[InputControl(usage = "DeviceRotation", offset = 17)]
[FieldOffset(17)]
public Quaternion deviceRotation;
[InputControl(usage = "Grip", layout = "Axis", offset = 33)]
[FieldOffset(33)]
public float grip;
[InputControl(alias = "gripPressed", usage = "GripButton", layout = "Button", offset = 37)]
[FieldOffset(37)]
public bool gripButton;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment