Пример #1
0
        public Tracker(ClientContext context, String path)
        {
            rollValue = pitchValue = yawValue = 0.0f;

            poseInterface = context.GetPoseInterface(path);
            positionInterface = context.GetPositionInterface(path);
            orientationInterface = context.GetOrientationInterface(path);

            poseInterface.StateChanged += PoseInterface_StateChanged;
            positionInterface.StateChanged += PositionInterface_StateChanged;
            orientationInterface.StateChanged += OrientationInterface_StateChanged;
        }
Пример #2
0
        public Tracker(ClientContext context, String path)
        {
            rollValue = pitchValue = yawValue = 0.0f;

            poseInterface        = context.GetPoseInterface(path);
            positionInterface    = context.GetPositionInterface(path);
            orientationInterface = context.GetOrientationInterface(path);

            poseInterface.StateChanged        += PoseInterface_StateChanged;
            positionInterface.StateChanged    += PositionInterface_StateChanged;
            orientationInterface.StateChanged += OrientationInterface_StateChanged;
        }
        public static void Main(string[] args)
        {
            ClientContext.PreloadNativeLibraries();
			using (ClientContext context = new ClientContext("com.osvr.exampleclients.managed.TrackerCallback"))
            {
                // This is just one of the paths. You can also use:
                // /me/hands/right
                // /me/head
                using (Interface lefthand = context.getInterface("/me/hands/left"))
                {

                    TrackerCallbacks callbacks = new TrackerCallbacks();
                    // The coordinate system is right-handed, withX to the right, Y up, and Z near.
                    var poseInterface = new PoseInterface(lefthand);
                    poseInterface.StateChanged += TrackerCallbacks.myTrackerCallback;

                    // If you just want orientation
                    var orientationInterface = new OrientationInterface(lefthand);
                    orientationInterface.StateChanged += TrackerCallbacks.myOrientationCallback;

                    // or position
                    var positionInterface = new PositionInterface(lefthand);
                    positionInterface.StateChanged += TrackerCallbacks.myPositionCallback;

                    bool resetYawMode = false;
                    // Pretend that this is your application's main loop
                    for (int i = 0; i < 1000000; ++i)
                    {
                        // toggle between reset yaw mode and normal mode
                        // every 5000 iterations.
                        if (i % 5000 == 0)
                        {
                            resetYawMode = !resetYawMode;
                            if(resetYawMode)
                            {
                                context.SetRoomRotationUsingHead();
                            }
                            else
                            {
                                context.ClearRoomToWorldTransform();
                            }
                        }
                        context.update();
                    }

                    Console.WriteLine("Library shut down; exiting.");
                }
            }
        }
Пример #4
0
        public static void Main(string[] args)
        {
            ClientContext.PreloadNativeLibraries();
            using (ServerAutoStarter serverAutoStarter = new ServerAutoStarter())
                using (ClientContext context = new ClientContext("com.osvr.exampleclients.managed.TrackerCallback"))
                {
                    // This is just one of the paths. You can also use:
                    // /me/hands/right
                    // /me/head
                    using (Interface lefthand = context.getInterface("/me/hands/left"))
                    {
                        TrackerCallbacks callbacks = new TrackerCallbacks();
                        // The coordinate system is right-handed, withX to the right, Y up, and Z near.
                        var poseInterface = new PoseInterface(lefthand);
                        poseInterface.StateChanged += TrackerCallbacks.myTrackerCallback;

                        // If you just want orientation
                        var orientationInterface = new OrientationInterface(lefthand);
                        orientationInterface.StateChanged += TrackerCallbacks.myOrientationCallback;

                        // or position
                        var positionInterface = new PositionInterface(lefthand);
                        positionInterface.StateChanged += TrackerCallbacks.myPositionCallback;

                        bool resetYawMode = false;
                        // Pretend that this is your application's main loop
                        for (int i = 0; i < 1000000; ++i)
                        {
                            // toggle between reset yaw mode and normal mode
                            // every 5000 iterations.
                            if (i % 5000 == 0)
                            {
                                resetYawMode = !resetYawMode;
                                if (resetYawMode)
                                {
                                    context.SetRoomRotationUsingHead();
                                }
                                else
                                {
                                    context.ClearRoomToWorldTransform();
                                }
                            }
                            context.update();
                        }

                        Console.WriteLine("Library shut down; exiting.");
                    }
                }
        }
Пример #5
0
    public Action Start()
    {
        //OSVR clients need an identifier
        context = new ClientContext("com.osvr.freepieClient");

        //OSVR interface for the head
        Interface head = context.getInterface("/me/head");

        //If you just want orientation
        orientationInterface = new OrientationInterface(head);
        positionInterface    = new PositionInterface(head);
        //add orientation callback
        orientationInterface.StateChanged += OrientationInterface_StateChanged;
        positionInterface.StateChanged    += PositionInterface_StateChanged;
        context.SetRoomRotationUsingHead(); //recenters the hmd position to the current position
        return(null);
    }
Пример #6
0
        public static void Main(string[] args)
        {
            ClientContext.PreloadNativeLibraries();
            using (ClientContext context = new ClientContext("com.osvr.exampleclients.managed.TrackerCallback"))
            {
                // This is just one of the paths. You can also use:
                // /me/hands/right
                // /me/head
                using (Interface lefthand = context.getInterface("/me/hands/left"))
                {

                    TrackerCallbacks callbacks = new TrackerCallbacks();
                    // The coordinate system is right-handed, withX to the right, Y up, and Z near.
                    var poseInterface = new PoseInterface(lefthand);
                    poseInterface.StateChanged += TrackerCallbacks.myTrackerCallback;

                    // If you just want orientation
                    var orientationInterface = new OrientationInterface(lefthand);
                    orientationInterface.StateChanged += TrackerCallbacks.myOrientationCallback;

                    // or position
                    var positionInterface = new PositionInterface(lefthand);
                    positionInterface.StateChanged += TrackerCallbacks.myPositionCallback;

                    // Pretend that this is your application's main loop
                    for (int i = 0; i < 1000000; ++i)
                    {
                        context.update();
                    }

                    Console.WriteLine("Library shut down; exiting.");
                }
            }
        }
Пример #7
0
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 public void Start()
 {
     vInterface = OrientationInterface.GetInterface(ContextProvider.Context, "/me/head");
 }
Пример #8
0
		////////////////////////////////////////////////////////////////////////////////////////////////
		/*--------------------------------------------------------------------------------------------*/
		public void Start() {
			vInterface = OrientationInterface.GetInterface(ContextProvider.Context, "/me/head");
		}
 // Use this for initialization
 void Start()
 {
     Follower = GetComponent<OrientationInterface>();
 }