Code Monkey home page Code Monkey logo

winmrsnippets's Introduction

WinMRSnippets

Sample code snippets for Windows Mixed Reality Application Developers.
The primary goal for these snippets is for people to learn, but you can also use this as a foundation of code to paste/include into your project.

What is included?

  • The WinMRSnippets folder has the reusable scripts. This includes:

    • GamepadWatcher - to detect when a gamepad is added/removed. It is event-driven instead of Unity's GetControllerNames() polling approach.
    • WinMRInputModule, WinMRGraphicsRayCaster, and WinMRPhysicsRayCaster. Together these three classes give you an input module for motion controllers, so you can easily handle Unity UI or 3D UI on an existing project. See notes below, on how to use it, and there is a sample scene.
    • MotionControllerVisualizer renders and tracks the WinMR motion controllers in a scene. This class is a very slightly modified version of the MotionControllerVisualizer from the Windows Mixed Reality Toolkit for Unity. The only reason for this copy is that some folks have found it cumbersome to include the whole toolkit in their projects. Here, if you copy the MotionControllers folder into your project you get something lighter/easier to incorporate into existing project code.
    • BoundaryGeometryVisualizer helps you draw the tracked Area for Windows Mixed reality (when in room scale).
  • WinMRSnippets-Examples includes examples for some of the classes above and a few extra scenarios that did not warrant a reusable class. Here is what you can look at:

    • ControllerListenersForLearning has scenes and scripts that you can use to get familiar with the various Unity APIs to track WinMR controllers. The UnityInputListener class uses Unity's Input APIs (which work on Steam & Rift) and InteractionManager sample uses Unity's WSA specific wrapper for controllers. The latter is the recommended way for tracking motion controllers in Windows MR.
    • SpacesAndXRDevice shows you how both Stationary and Room scale configurations work in WinMR
    • Voice sample shows you how to use Unity's KeywordRecognizer for voice commands.

How to use the Input Module Sample

  • To try the input module check the InputModuleTest scene.

  • Ensure your event system has a WinMRInputModule and no standalone input module

  • Ensure you have a WinMRPhysicsRaycaster in the scene- if you want to use 3D objects -- you don't need it otherwise

  • Ensure you have a WinMRGraphicsRaycaster in your canvas to UI objects

  • Here are options to know about in WinMRInputModule

    • AllowedSelectInput lets you choose if you want to use gaze (after a timeout), motion controller, or gamepad (A) to select. You can choose multiple ones, but note that in current 'single' mode, you can only have one active between gaze and controller. If the controller is active, gaze timeout won't be used.
    • AllowedCursorInput chooses what you can use as a cursor. The default is gaze but after a controller is pressed, we switch to controller. Turn controller off to get back to gaze.
    • TimeToGazeClick == the length in seconds for a control to have focus when gaze automatically clicks (default is 3 seconds). Make sure if using debug cursor that it matches CircularLoader's FinalTime.. or make FinalTime 0.

Feedback and/or requests

If you have any feedback please file an issue. If there is a sample you want to see included please request it too.

winmrsnippets's People

Contributors

jaimerodriguez avatar

Stargazers

Peter "Shawty" Shaw avatar Vlad Kolesnikov avatar Pete D avatar Adam Tuliper avatar

Watchers

 avatar James Cloos avatar Eric Ahlstrom avatar Adam Tuliper avatar Vlad Kolesnikov avatar  avatar

Forkers

stammen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.