Giter Site home page Giter Site logo

ebadier / vivetrackers Goto Github PK

View Code? Open in Web Editor NEW
33.0 1.0 9.0 6.29 MB

A simple library to use HTC Vive Tracker devices in Unity

License: MIT License

C# 100.00%
unity3d vive-trackers openvr csharp tracking htc-vive virtual-reality motion-capture steamvr

vivetrackers's Introduction

alt text

Use HTC Vive Tracker devices in Unity3D with the following benefits

  • Directly use OpenVR API for best performance
  • Current features include update of positions, rotations, and Pogo-Pins buttons
  • Small library, easy to integrate in any projects
  • A simulator, to develop without having a Vive tracking system connected
  • A complete test scene to understand the use of the library
  • Some documentation to setup Unity3D, SteamVR (with & without an HMD connected), and Windows to get the best tracking quality from your Vive Trackers

Getting Started

1. Open SteamVR, configure your tracking space, connect your Vive Trackers, and leave SteamVR running in the background.

2. Open the ViveTrackersTest scene in Unity and press Play.

3. Hotkeys used to control the application:

  • F1 : show/hide local reference frames of ViveTrackers.
  • F5 : refresh the list of currently connected ViveTrackers.
  • F8 : calibrate the ViveTrackers (make their local reference frames aligned with the Origin reference frame).
  • F6 : save the last calibration.
  • F7 : load the last calibration.

4. Understanding the code:

  • The update of all ViveTrackers (position, rotation, and optionally buttons) happens at the first line in ViveTrackersTest.Update(), see ViveTrackersManager.UpdateTrackers() for more details.
  • ViveTrackersManager contains a list of all connected ViveTrackers.
  • Optionally, ViveTrackersManager can create only a restricted set of ViveTrackers declared in the file ViveTrackers.csv (see documentation/"Keep Vive Trackers identification consistent during runtime").
  • To log your ViveTrackers serial numbers in the console, ensure ViveTrackersManager.logTrackersDetection is enabled in Unity editor.
  • You can access the last position/rotation of ViveTrackers using their transform.localPosition/localRotation.
  • You can also register to some actions to know if the pogo-pins corresponding to Grip/Trigger/TouchPad/Menu buttons are pressed or released.

System requirements

Unity 2017.4.35f1 and newer versions

vivetrackers's People

Contributors

ebadier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

vivetrackers's Issues

How to get the button input on the Tracker?

I am new to Unity, but I thought it might be handy for other people as well.

I want to attach buttons to the Trackers via the pogo pins.

Is there a way to reveal that data per Tracker?

I found this script, but I am not able to intregrate it in your Tracker System (still learning...)
https://unity3d.college/2017/08/14/using-htc-vive-tracker-pogo-pins-unity3d/

using UnityEngine;

public class TriggerTester : MonoBehaviour
{
private SteamVR_TrackedObject trackedObject;

[SerializeField]
private bool trigger;
[SerializeField]
private bool trackpad;
[SerializeField]
private bool grip;
[SerializeField]
public bool menu;

private void Start()
{
    trackedObject = GetComponent<SteamVR_TrackedObject>();
}

private void Update()
{
    var device = SteamVR_Controller.Input((int)trackedObject.index);

    trigger = device.GetPress(Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger);
    grip = device.GetPress(Valve.VR.EVRButtonId.k_EButton_Grip);
    trackpad = device.GetPress(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad);
    menu = device.GetPress(Valve.VR.EVRButtonId.k_EButton_ApplicationMenu);
}

}

Buttons not working when building for windows

Hi,

registering button presses on the trackers is working well, except when I build as an application. I tried 32 and 64 bit, the trackers are showing up fine, but I don't get data back on the buttons. Is this a know issue, or am I overlooking something?

Help would be greatly appreciated,
thanks again

N.B. sometimes the buttons don't register even in Edit mode, but going to SteamVR > Devices > Manage Tracker >> change Tracker Role to Camera, close, change Tracker Role back to Held in Hand, fixes this issue.

How to get pose from VIVE tracker?

Hi @ebadier, can you help me please?

I have this tracker: https://www.vive.com/us/accessory/tracker3/

I need for my project to get the rotational and positional location of the tracker

Please could you help me and tell me the easiest way that we can get the position of the tracker in a C# script?

That by sending a command through C# script how can we get the above data at a certain time?

Thanks in advance!

Is it possible to restart steamvr?

The tracker position may be misplaced during use.
If you restart the desktop steamvr app, it will be restored
Is there a command to re-run the steamvr app within unity?

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.