• Guides
    • English
    • 日本語
  • API Documentation
  • アーキテクチャ
  • Input System (入力システム)
  • Controllers, Pointers, and Focus

    Show / Hide Table of Contents
    • MRTK を始める
      • Release Notes
      • MRTK Package Contents
      • Updating from earlier versions
      • HTK からの移植ガイド
      • MRTK のビルドとデプロイ
      • NuGet Packages
      • Getting started with MRTK and XR SDK
      • Performance
      • Hologram Stabilization (ホログラムの安定化)
    • アーキテクチャ
      • 全体像
      • フレームワークとランタイム
      • Input System (入力システム)
        • 用語
        • Core System
        • Controllers, Pointers, and Focus
      • Systems, Extension Services and Data Providers
    • 機能概要
      • Boundary System
        • Boundary System Overview
        • Configuring the Boundary Visualization
      • Camera System
        • Camera System Overview
        • Camera Settings Providers
          • Windows Mixed Reality Camera Settings
          • Unity AR Camera Settings [Experimental]
          • Creating a camera settings provider
      • Cross Platform Support
        • Configure MRTK for iOS and Android
      • プラットフォームの Capabilities (機能) を検出する
      • Diagnostics System (診断システム)
        • 診断システムの概要
        • 診断システムの構成
        • ビジュアル プロファイラーを使用する
      • Extension Services
        • Extension Service Creation Wizard
        • Scene Transition Service Overview
        • Hand Physics Service Overview
      • Input System (入力システム)
        • 入力の概要
        • Input Actions
        • Input Events
        • Input Providers
          • Input Providers Overview
          • Creating an input data provider
        • Controllers (コントローラー)
        • Eyes
        • Gaze (ゲイズ)
        • Gestures (ジェスチャ)
        • Hands
        • How to Add Near Interaction
        • エディター内入力シミュレーション
        • Pointers
        • Voice Input
          • Dictation (ディクテーション)
          • Speech (コマンドとコントロール)
      • Multi Scene System
        • Multi Scene System Overview
        • Scene Types
        • Content Scene Loading
        • Monitoring Content Loading
        • Lighting Scene Operations
      • パッケージ
        • MRTK パッケージ
        • MRTK Modularization
      • Profiles (プロファイル)
        • プロファイル概要
        • 設定ガイド
      • Rendering
        • Material Instance Overview
        • Shaders
          • MRTK Standard Shader
      • Services (サービス)
        • What makes a mixed reality feature
        • MixedRealityServiceRegistry と IMixedRealityServiceRegistrar とは何か
        • Extension services
      • Spatial Awareness System (空間認識システム)
        • Spatial Awareness (空間認識) 概要
        • Spatial Observers
          • Configuring Observers for Device
          • Configuring Observers for Editor
          • Controlling Observers via Code
          • Creating a custom Observer
      • Teleport System (テレポートシステム) 概要
      • ツール
        • Dependency Window (依存関係ウィンドウ)
        • Extension Service Creation Wizard
        • Holographic Remoting
        • Input Animation Recording
          • Input Animation File Format Specification
        • Optimize Window
        • Runtime tools
          • Controller Mapping tool
      • UX ビルディング ブロック
        • Interactable (インタラクタブル)
        • Button (ボタン)
        • Bounding Box
        • Object Manipulation (物体操作)
        • Sliders (スライダー)
        • Fingertip Visualization
        • App Bar
        • Object Collection (オブジェクトコレクション)
        • Slate (スレート)
        • System Keyboard (システム キーボード)
        • Tooltips (ツールチップ)
        • Solvers (ソルバー)
      • Example Scenes
        • Examples Hub
        • ハンド インタラクションのサンプル
        • アイ トラッキング インタラクションのサンプル
      • Experimental
        • Scrolling Object Collection
        • Hand Coach UX
        • Pulse Shader
    • Contributing
      • Contributing Overview
      • Coding Guidelines
      • Writing and Running Tests
      • Writing Documentation
      • Pull Requests
      • Experimental Features
      • Breaking Changes
      • How to use DocFX
    • Planning
      • Roadmap
    • Notice
    • Authors

    Controllers, pointers, and focus

    Controllers, pointers, and focus are higher-level concepts that build upon the foundation established by the core input system. Together, they provide a large portion of the mechanism for interacting with objects in the scene.

    Controllers

    Controllers are representations of a physical controller (6-degrees of freedom, articulated hand, etc). They are created by device managers and are responsible for communicating with the corresponding underlying system and translating that data into MRTK-shaped data and events.

    For example, on the Windows Mixed Reality platform, the WindowsMixedRealityArticulatedHand is a controller that is responsible for interfacing with the underlying Windows hand tracking APIs to get information about the joints, pose, and other properties of the hand. It is responsible for turning this data into relevant MRTK events (for example, by calling RaisePoseInputChanged or RaiseHandJointsUpdated) and by updating its own internal state so that queries for TryGetJointPose will return correct data.

    Generally, a controller's lifecycle will involve:

    1. A controller gets created by a device manager upon detection of a new source (for example, the detects and starts tracking a hand).

    2. In the controller's Update() loop, it calls into its underlying API system.

    3. In the same update loop, it raises input event changes by calling directly into the core input system itself (for example, raising HandMeshUpdated, or HandJointsUpdated).

    Pointers and focus

    Pointers are used to interact with game objects. This section describes how pointers are created, how they get updated, and how they determine the object(s) that are in focus. It will also cover the different types of pointers that exist and the scenarios in which they are active.

    Pointer categories

    Pointers generally fall into one of the following categories:

    • Far pointers

      These types of pointers are used to interact with objects that are far away from the user (far away is defined as simply “not near”). These types of pointers generally cast lines that can go far into the world and allow the user to interact with and manipulate objects that are not immediately next to them.

    • Near pointers

      These types of pointers are used to interact with objects that are close enough to the user to grab, touch, and manipulate. Generally, these types of pointers interact with objects by looking for objects in the nearby vicinity (either by doing raycasting at small distances, doing spherical casting looking for objects in the vicinity, or enumerating lists of objects that are considered grabbable/touchable).

    • Teleport pointers

      These types of pointers plug into the teleportation system to handle moving the user to the location targeted by the pointer.

    Pointer mediation

    Because a single controller can have multiple pointers (for example, the articulated hand can have both near and far interaction pointers), there exists a component that is responsible for mediating which pointer should be active.

    For example, as the user’s hand approaches a pressable button, the ShellHandRayPointer should stop showing, and the PokePointer should be engaged.

    This is handled by the DefaultPointerMediator, which is responsible for determining which pointers are active, based on the state of all pointers. One of the key things this does is disable far pointers when a near pointer is close to an object.

    It's possible to provide an alternate implementation of the pointer mediator by changing the PointerMediator property on the pointer profile.

    How to disable pointers

    Because the pointer mediator runs every frame, it ends up controlling the active / inactive state of all pointers. Therefore, if you set a pointer's IsInteractionEnabled property in code, it will get overwritten by the pointer mediator every frame. Instead, you can specify the PointerBehavior to control whether pointers should be on or off yourself. Note that this will only work if you are using the default FocusProvider and DefaultPointerMediator in MRTK.

    Example: Disable hand rays in MRTK

    The following code will turn off the hand rays in MRTK:

    // Turn off all hand rays
    PointerUtils.SetHandRayPointerBehavior(PointerBehavior.AlwaysOff);
    
    // Turn off hand rays for the right hand only
    PointerUtils.SetHandRayPointerBehavior(PointerBehavior.AlwaysOff, Handedness.Right);
    

    The following code will return hand rays to their default behavior in MRTK:

    PointerUtils.SetHandRayPointerBehavior(PointerBehavior.Default);
    

    The following code will force hand rays to be on, regardless if near a grabbable:

    // Turn off all hand rays
    PointerUtils.SetHandRayPointerBehavior(PointerBehavior.AlwaysOn);
    

    See PointerUtils and TurnPointersOnOff for more examples.

    FocusProvider

    The FocusProvider is the workhorse that is responsible for iterating over the list of all pointers and figuring out what the focused object is for each pointer.

    In each Update() call, this will:

    1. Update all of the pointers, by raycasting and doing hit detection as-configured by the pointer itself (for example, the sphere pointer could specify the SphereOverlap raycastMode, so FocusProvider will do a sphere-based collision)

    2. Update the focused object on a per-pointer basis (i.e. if an object gained focus, it would also trigger events to those object, if an object lost focus, it would trigger focus lost, etc).

    Pointer configuration and lifecycle

    Pointers can be configured in the Pointers section of the input system profile.

    The lifetime of a pointer is generally the following:

    1. A device manager will detect the presence of a controller. This device manager will then create the set of pointers associated with the controller via a call to RequestPointers.

    2. The FocusProvider, in its Update() loop, will iterate over all of the valid pointers and do the associated raycast or hit detection logic. This is used to determine the object that is focused by each particular pointer.

      • Because it's possible to have multiple sources of input active at the same time (for example, two hands active present), it's also possible to have multiple objects that have focus at the same time.
    3. The device manager, upon discovering that a controller source was lost, will tear down the pointers associated with the lost controller.

    • Improve this Doc
    In This Article
    • Controllers
    • Pointers and focus
      • Pointer categories
    • Pointer mediation
      • How to disable pointers
        • Example: Disable hand rays in MRTK
      • FocusProvider
      • Pointer configuration and lifecycle
    Back to top Generated by DocFX