Example #1
0
    /// <summary>
    /// Set the hand collider tag.
    /// </summary>
    private void Start()
    {
        gameObject.tag  = "Player";
        collidings      = new List <Collider>();
        smoothingBuffer = new Queue <Vector3>();
        for (i = 0; i < smoothingFrame; i++)
        {
            smoothingBuffer.Enqueue(Vector3.zero);
            xSum = 0;
            ySum = 0;
            zSum = 0;
        }
        trianglurNumber = smoothingFrame * (smoothingFrame + 1) / 2;

        if (entity.IsOwner)
        {
            _manomotionManager = GameObject.FindGameObjectWithTag("ManomotionManager").GetComponent <ManomotionManager>();
        }

        grabTrigger = ManoGestureTrigger.GRAB_GESTURE;
        pinch       = ManoGestureContinuous.HOLD_GESTURE;

        worldOrigin = GameObject.FindGameObjectWithTag("WorldOrigin");
        // worldOriginOffsetPosition = worldOrigin.transform.position;
        // worldOriginOffsetRotaion = worldOrigin.transform.rotation;
        // transform.rotation = worldOriginOffsetRotaion;
        // transform.rotation = worldOrigin.transform.InverseTransformDirection(Vector3.zero);
    }
Example #2
0
 protected void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this.gameObject);
         Debug.LogWarning("More than 1 Manomotionmanager in scene");
     }
 }
Example #3
0
    /// <summary>
    /// Set the hand collider tag.
    /// </summary>
    private void Start()
    {
        gameObject.tag  = "Player";
        collidings      = new List <Collider>();
        smoothingBuffer = new Queue <Vector3>();
        for (i = 0; i < smoothingFrame; i++)
        {
            smoothingBuffer.Enqueue(Vector3.zero);
            xSum = 0;
            ySum = 0;
            zSum = 0;
        }
        trianglurNumber = smoothingFrame * (smoothingFrame + 1) / 2;

        manomotionManager = GameObject.Find("ManomotionManager").GetComponent <ManomotionManager>();
    }
Example #4
0
 protected virtual void Awake()
 {
     if (instance == null)
     {
         Debug.Log("Awake method of the ManoMotionManager");
         instance = this;
         ManoUtils.OnOrientationChanged             += HandleOrientationChanged;
         InputManagerPhoneCamera.OnFrameInitialized += HandleManoMotionFrameInitialized;
         InputManagerPhoneCamera.OnFrameUpdated     += HandleNewFrame;
         InputManagerPhoneCamera.OnFrameResized     += HandleManoMotionFrameResized;
     }
     else
     {
         this.gameObject.SetActive(false);
         Debug.LogWarning("More than 1 Manomotionmanager in scene");
     }
 }
    /// <summary>
    ///   Displays the hand layer that can be on top or behind the virtual objects
    /// </summary>
    /// <param name="hand_info">Hand information provided by Manomotion Manager class</param>
    /// <param name="layer_hands">Reference to the meshrenderer of the hands</param>
    /// <param name="mano_manager">Reference to the Manomotion Manager class</param>
    void ShowLayering(HandInfoUnity hand_info, MeshRenderer layer_hands, ManomotionManager mano_manager)
    {
        layer_hands.gameObject.SetActive(_show_hand_layer);
        layering_object.SetActive(_show_hand_layer);
        if (_show_hand_layer)
        {
            ManoUtils.Instance.OrientMeshRenderer(layer_hands);

            //Assign the texture
            layer_hands.material.mainTexture = hand_info.cut_rgb;

            //Move forward according to depth
            layer_hands.transform.localPosition = Vector3.forward * hand_info.hand_info.tracking_info.relative_depth;

            //Adjust the size in order to fit the screen
            mano_utils.AjustBorders(layer_hands, ManomotionManager.Instance.Manomotion_Session);
        }
    }
    protected virtual void Awake()
    {
        if (instance == null)
        {
            transform.GetComponent <InputManagerArFoundation>().StoragePermisionCheck();
            ManoUtils.OnOrientationChanged           += HandleOrientationChanged;
            InputManagerBaseClass.OnAddonSet         += HandleAddOnSet;
            InputManagerBaseClass.OnFrameInitialized += HandleManoMotionFrameInitialized;
            InputManagerBaseClass.OnFrameUpdated     += HandleNewFrame;
            InputManagerBaseClass.OnFrameResized     += HandleManoMotionFrameResized;
            instance = this;
        }

        else
        {
            this.gameObject.SetActive(false);
            Debug.LogWarning("More than 1 Manomotionmanager in scene");
        }
    }
Example #7
0
    private void Awake()
    {
        if (_instance == null)
        {
            _instance = this;
            InputManager.OnFrameInitialized += InitializeManoMotionManager;
            InputManager.OnFrameUpdated     += ProcessManomotion;
            InputManager.OnFrameResized     += ResizeToFitFrame;
        }
        else
        {
            this.gameObject.SetActive(false);
            Debug.LogWarning("More than 1 Manomotionmanager in scene");
        }

#if UNITY_EDITOR
        isInitialized = true;
#endif
    }
    protected void Update()
    {
        if (!ManomotionManager.Instance)
        {
            instance = this;
            Debug.LogWarning("ManomotionManager.Instance");
        }

        if (_initialized)
        {
            if (!isPaused)
            {
                CalculateFPSAndProcessingTime();
                GetCameraFramePixelColors();
                UpdateTexturesWithNewInfo();
                ProcessManomotion();
                UpdateOrientation();
            }
        }
    }
Example #9
0
    /// <summary>
    ///   Displays the hand layer that can be on top or behind the virtual objects
    /// </summary>
    /// <param name="hand_info">Hand information provided by Manomotion Manager class</param>
    /// <param name="layer_hands">Reference to the meshrenderer of the hands</param>
    /// <param name="mano_manager">Reference to the Manomotion Manager class</param>
    void ShowLayering(HandInfoUnity hand_info, MeshRenderer layer_hands, ManomotionManager mano_manager)
    {
        layer_hands.enabled = _show_hand_layer;
        layering_sphere.SetActive(_show_hand_layer);
        if (_show_hand_layer)
        {
            // Fix rotation based on Orientation
            switch (ManomotionManager.Instance.Manomotion_Session.orientation)
            {
            case SupportedOrientation.PORTRAIT:
                layer_hands.transform.rotation = Quaternion.Euler(0, 0, -90);
                break;

            case SupportedOrientation.PORTRAIT_INVERTED:
                layer_hands.transform.rotation = Quaternion.Euler(0, 0, 90);
                break;

            case SupportedOrientation.LANDSCAPE_LEFT:
                layer_hands.transform.rotation = Quaternion.Euler(0, 0, 0);
                break;

            case SupportedOrientation.LANDSCAPE_RIGHT:
                layer_hands.transform.rotation = Quaternion.Euler(0, 0, 180);
                break;

            default:
                break;
            }

            //Assign the texture
            layer_hands.material.mainTexture = hand_info.cut_rgb;

            //Move forward according to depth
            layer_hands.transform.localPosition = Vector3.forward * hand_info.hand_info.tracking_info.relative_depth;

            //Adjust the size in order to fit the screen
            mano_utils.AjustBorders(layer_hands, cam, false);
        }
    }
    /// <summary>
    /// Loads the stored calibration value.
    /// </summary>
    void LoadCalibration()
    {
        ManomotionManager manager = ManomotionManager.Instance;

        manager.SetCalibration(PlayerPrefs.GetInt("calibration_value", 15));
    }