Skip to content

Instantly share code, notes, and snippets.

@KzoNag
Created December 14, 2022 11:09
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/78c074100c8e4a77fa6bb1c13dee808d to your computer and use it in GitHub Desktop.
Save KzoNag/78c074100c8e4a77fa6bb1c13dee808d to your computer and use it in GitHub Desktop.
ブログ用 - VIVE Flowのコントローラー定義
[Preserve]
#if UNITY_EDITOR
[UnityEditor.InitializeOnLoad]
#endif
[InputControlLayout(displayName = "Wave Controller", commonUsages = new[] { "LeftHand", "RightHand" })]
public class WaveController : XRControllerWithRumble
{
[Preserve]
[InputControl(aliases = new[] { "RightControllerTrackingState", "LeftControllerTrackingState" })]
public new IntegerControl trackingState { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "RightControllerIsTracked", "LeftControllerIsTracked" })]
public new ButtonControl isTracked { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "RightControllerPosition", "LeftControllerPosition" })]
public new Vector3Control devicePosition { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "RightControllerRotation", "LeftControllerRotation" })]
public new QuaternionControl deviceRotation { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "RightControllerTriggerTriggerAxis", "LeftControllerTriggerTriggerAxis" })]
public AxisControl trigger { get; private set; }
// 省略...
protected override void FinishSetup()
{
base.FinishSetup();
trackingState = GetChildControl<IntegerControl>("trackingState");
isTracked = GetChildControl<ButtonControl>("isTracked");
devicePosition = GetChildControl<Vector3Control>("devicePosition");
deviceRotation = GetChildControl<QuaternionControl>("deviceRotation");
trigger = GetChildControl<AxisControl>("trigger");
// 省略...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment