/// @brief Initializes the appropriate additional members depending on @ref m_startingPoseReferenceType
 protected void InitReferenceState()
 {
     if (m_startingPoseReferenceType == StartingPosReferenceType.ScaledModifierToOtherJoint)
     {
         m_lastFrameScaleJoint1 = new NIPositionTrackerFrameManager();
         m_lastFrameScaleJoint2 = new NIPositionTrackerFrameManager();
     }
     if (m_startingPoseReferenceType == StartingPosReferenceType.ScaledModifierToOtherJoint ||
         m_startingPoseReferenceType == StartingPosReferenceType.StaticModifierToOtherJoint)
     {
         m_lastFrameReferenceJoint = new NIPositionTrackerFrameManager();
     }
 }
    /// an internal method to initialize the internal structures
    /// @note in most cases, inheriting methods should NOT override the base InitTracking but
    /// rather override this method.
    /// @return true on success and false otherwise.
    protected override bool InitInternalStructures()
    {
        if (m_context == null || m_context.Valid == false)
        {
            return(false); // we need hands for this...
        }
        m_handsManager = FindObjectOfType(typeof(NITEHandsManager)) as NITEHandsManager;
        if (m_handsManager == null || m_handsManager.ValidWithInit == false)
        {
            throw new System.Exception("There is no NITEHandsManager in the scene!");
        }
        // need to make sure we don't get errors in initialization
        try
        {
            NINITECheckVersion.Instance.ValidatePrerequisite();
            // set up the raw control point (to get raw data)
            m_pointControlRaw = new PointControl();
            m_handsManager.Hands.SessionManager.AddListener(m_pointControlRaw);

            // set up the denoiser filter
            m_pointControlSmoothFilter = new PointDenoiser();
            m_handsManager.Hands.SessionManager.AddListener(m_pointControlSmoothFilter);
            // set up the smoothed control point (to get smoothed data).
            m_pointControlSmooth = new PointControl();
            m_pointControlSmoothFilter.AddListener(m_pointControlSmooth);

            // register the relevant callbacks
            m_pointControlRaw.PrimaryPointUpdate    += new System.EventHandler <HandEventArgs>(myControl_PrimaryPointUpdate);
            m_pointControlRaw.PrimaryPointCreate    += new System.EventHandler <HandFocusEventArgs>(myControl_PrimaryPointCreate);
            m_pointControlRaw.PrimaryPointDestroy   += new System.EventHandler <IdEventArgs>(myControl_PrimaryPointDestroy);
            m_pointControlSmooth.PrimaryPointUpdate += new System.EventHandler <HandEventArgs>(myControl_PrimaryPointUpdateSmooth);
        }
        catch (System.Exception ex)
        {
            Debug.Log("failed to initialize. Error=" + ex.Message);
            StopTracking();
            return(false);
        }
        m_lastFrameCurPoint    = new NIPositionTrackerFrameManager();
        m_lastFrameCurPointRaw = new NIPositionTrackerFrameManager();
        return(true);
    }
 /// @brief Initializes the appropriate additional members depending on @ref m_startingPoseReferenceType
 protected void InitReferenceState()
 {
     if(m_startingPoseReferenceType==StartingPosReferenceType.ScaledModifierToOtherJoint)
     {
         m_lastFrameScaleJoint1 = new NIPositionTrackerFrameManager();
         m_lastFrameScaleJoint2 = new NIPositionTrackerFrameManager();
     }
     if(m_startingPoseReferenceType==StartingPosReferenceType.ScaledModifierToOtherJoint ||
        m_startingPoseReferenceType == StartingPosReferenceType.StaticModifierToOtherJoint)
     {
         m_lastFrameReferenceJoint = new NIPositionTrackerFrameManager();
     }
 }
 /// an internal method to initialize the internal structures
 /// @note in most cases, inheriting methods should NOT override the base @ref InitTracking but
 /// rather override this method.
 /// @return true on success and false otherwise.
 protected override bool InitInternalStructures()
 {
     m_lastFrameCurPoint = new NIPositionTrackerFrameManager();
     InitReferenceState();
     return true;
 }
 public override void StopTracking()
 {
     base.StopTracking();
     m_lastFrameCurPoint = null;
     m_lastFrameReferenceJoint = null;
     m_lastFrameScaleJoint1 = null;
     m_lastFrameScaleJoint2 = null;
 }
 /// an internal method to initialize the internal structures
 /// @note in most cases, inheriting methods should NOT override the base @ref InitTracking but
 /// rather override this method.
 /// @return true on success and false otherwise.
 protected override bool InitInternalStructures()
 {
     m_lastFrameCurPoint = new NIPositionTrackerFrameManager();
     InitReferenceState();
     return(true);
 }