Beispiel #1
0
 public void UpdateImage()
 {
     if (tracker != IntPtr.Zero)
     {
         PSMoveAPI.psmove_tracker_update_image(tracker);
     }
 }
Beispiel #2
0
        private void UpdateRumbleAndLED()
        {
            // Update led color or set the automatic tracking recommended color
            UpdateLedColor();

            // Send rumble and leds notification back to the controller
            PSMoveAPI.psmove_update_leds(move);
        }
Beispiel #3
0
 private void PollInternalData()
 {
     // Poll data (IMU and buttons)
     while (PSMoveAPI.psmove_poll(move) != 0)
     {
         ;
     }
 }
Beispiel #4
0
        // **************
        // Connection
        // **************

        public bool Connect()
        {
            move = PSMoveAPI.psmove_connect_by_id(Index);
            // Enable inner psmoveapi IMU fusion
            PSMoveAPI.psmove_enable_orientation(move, 1);
            // Enable positional tracking for this device
            PSMoveAPI.psmove_tracker_enable(tracker.TrackerHandle, move);
            return(isConnected());
        }
Beispiel #5
0
        private void UpdatePosition()
        {
            // Update positional tracking info for this move
            PSMoveAPI.psmove_tracker_update(tracker.TrackerHandle, move);

            // Retrieve positional tracking data
            PSMoveAPI.psmove_fusion_get_position(tracker.FusionHandle, move,
                                                 ref x, ref y, ref z);
            rawPosition.Update(x, y, z);
        }
Beispiel #6
0
 private void UpdateLedColor()
 {
     // Check the camera tracking color update
     if (AutoLedColor)
     {
         // If the color is automatically recommended by the camera, get it now
         PSMoveAPI.psmove_tracker_get_color(tracker.TrackerHandle, move, ref r, ref g, ref b);
         led.SetColor(r, g, b);
     }
     else
     {
         // If the color is manually set, let the tracker know
         PSMoveAPI.psmove_tracker_set_camera_color(tracker.TrackerHandle, move, led.r, led.g, led.b);
     }
     // Finally set the led color
     PSMoveAPI.psmove_set_leds(move, led.r, led.g, led.b);
 }
Beispiel #7
0
        private void UpdateOrientation()
        {
            // Orientation data
            PSMoveAPI.psmove_get_orientation(move, ref w, ref x, ref y, ref z);
            rotation.Update(w, z, x, y, false); // This update without conjugation solves the yaw problem

            // Gyroscope data
            PSMoveAPI.psmove_get_gyroscope_frame(move,
                                                 PSMove.PSMove_Frame.Frame_SecondHalf,
                                                 ref x, ref y, ref z);
            gyroscope.Update(x, y, z);

            // Accelerometer data
            PSMoveAPI.psmove_get_accelerometer_frame(move,
                                                     PSMove.PSMove_Frame.Frame_SecondHalf,
                                                     ref x, ref y, ref z);
            accelerometer.Update(x, y, z);
        }
Beispiel #8
0
 public void SetDimming(float dimming)
 {
     // Disable light bulb auto dimming effect
     PSMoveAPI.psmove_tracker_set_dimming(tracker, 1);
 }
Beispiel #9
0
 public void Stop()
 {
     PSMoveAPI.psmove_fusion_free(fusion);
     PSMoveAPI.psmove_tracker_free(tracker);
 }
Beispiel #10
0
 public void Start()
 {
     // Create the tracker object
     tracker = PSMoveAPI.psmove_tracker_new();
     fusion  = PSMoveAPI.psmove_fusion_new(tracker, 1, 1000);
 }
Beispiel #11
0
 public void Disconnect()
 {
     PSMoveAPI.psmove_disconnect(move);
 }
Beispiel #12
0
 private void UpdateButtons()
 {
     // Button Events
     buttons = PSMoveAPI.psmove_get_buttons(move);
     PSMoveAPI.psmove_get_button_events(move, ref buttonsPressed, ref buttonsReleased);
 }
Beispiel #13
0
 public void resetOrientation()
 {
     PSMoveAPI.psmove_reset_orientation(move);
 }