Beispiel #1
0
    void Update()
    {
        //depthBuffer の更新

        if (DepthSourceManager == null)
        {
            return;
        }

        _DepthManager = DepthSourceManager.GetComponent <DepthSourceManager>();

        depthBuffer = _DepthManager.GetData();

        // 指の判定

        checkPoint();

        // 初期化キー待機

        if (Input.GetKey(KeyCode.I))
        {
            Invoke("setFirstPoint", 0.5f);
        }
        if (Input.GetKey(KeyCode.C))
        {
            // 球体の半径取得

            IndexDatas indexDatasObj = GetComponent <IndexDatas>();

            int radius = checkCircleLength(indexDatasObj.indexes_Y[3]);

            GameObject gameobject = Instantiate(painter, new Vector3(indexDatasObj.indexes_X[3], indexDatasObj.indexes_Y[3], 1), Quaternion.identity);
            gameobject.transform.localScale = new Vector3(radius, radius, 1);
        }
    }
Beispiel #2
0
    // 指の check

    private void checkPoint()
    {
        IndexDatas indexDatasObj = GetComponent <IndexDatas>();

        if (firstPoints[indexDatasObj.Indexes[0]] == 0 && firstPoints[indexDatasObj.Indexes[1]] == 0 && firstPoints[indexDatasObj.Indexes[2]] == 0 && firstPoints[indexDatasObj.Indexes[3]] == 0)
        {
            Debug.LogWarning("今すぐセットやれえぇindexDatasObj.Indexes[0] (push 'i')");
            UnsetDataSwitch = true;
        }
        else
        {
            UnsetDataSwitch = false;
        }

        // 判定

        if (maxchangedistance > Mathf.Abs(firstPoints[indexDatasObj.Indexes[0]] - depthBuffer[indexDatasObj.Indexes[0]]) && Mathf.Abs(firstPoints[indexDatasObj.Indexes[0]] - depthBuffer[indexDatasObj.Indexes[0]]) > minchangedistance && UnsetDataSwitch == false)
        {
            Debug.Log("rightHigh changing");
            swiches[0] = true;
        }
        else
        {
            swiches[0] = false;
        }
        if (maxchangedistance > Mathf.Abs(firstPoints[indexDatasObj.Indexes[1]] - depthBuffer[indexDatasObj.Indexes[1]]) && Mathf.Abs(firstPoints[indexDatasObj.Indexes[1]] - depthBuffer[indexDatasObj.Indexes[1]]) > minchangedistance && UnsetDataSwitch == false)
        {
            Debug.Log("rightLow changing");
            swiches[1] = true;
        }
        else
        {
            swiches[1] = false;
        }
        if (maxchangedistance > Mathf.Abs(firstPoints[indexDatasObj.Indexes[2]] - depthBuffer[indexDatasObj.Indexes[2]]) && Mathf.Abs(firstPoints[indexDatasObj.Indexes[2]] - depthBuffer[indexDatasObj.Indexes[2]]) > minchangedistance && UnsetDataSwitch == false)
        {
            Debug.Log("leftHigh changing");
            swiches[2] = true;
        }
        else
        {
            swiches[2] = false;
        }
        if (maxchangedistance > Mathf.Abs(firstPoints[indexDatasObj.Indexes[3]] - depthBuffer[indexDatasObj.Indexes[3]]) && Mathf.Abs(firstPoints[indexDatasObj.Indexes[3]] - depthBuffer[indexDatasObj.Indexes[3]]) > minchangedistance && UnsetDataSwitch == false)
        {
            Debug.Log("leftLow changing");
            swiches[3] = true;
        }
        else
        {
            swiches[3] = false;
        }
    }
Beispiel #3
0
    void Start()
    {
        // kinect の取得

        kinect = KinectSensor.GetDefault();

        // depthBuffer の初期化
        depthBuffer = new ushort[kinect.DepthFrameSource.FrameDescription.LengthInPixels];

        // IndexData の取得
        IndexDatas indexDatasObj = GetComponent <IndexDatas>();
    }
    void Start()
    {
        // index の取得

        IndexDatas indexDatasObj = GetComponent <IndexDatas>();

        // x, y の取得

        for (int i = 0; i < 4; i++)
        {
            Instantiate(pointer, new Vector3(indexDatasObj.indexes_X[i], indexDatasObj.indexes_Y[i], z), Quaternion.identity);
        }
    }