コード例 #1
0
ファイル: BodySourceView.cs プロジェクト: Smoothstep/VRChat
 // Token: 0x060029EA RID: 10730 RVA: 0x000D59A4 File Offset: 0x000D3DA4
 private void RefreshBodyObject(Body body, GameObject bodyObject)
 {
     for (JointType jointType = JointType.SpineBase; jointType <= JointType.ThumbRight; jointType++)
     {
         Windows.Kinect.Joint joint  = body.Joints[jointType];
         Windows.Kinect.Joint?joint2 = null;
         if (this._BoneMap.ContainsKey(jointType))
         {
             joint2 = new Windows.Kinect.Joint?(body.Joints[this._BoneMap[jointType]]);
         }
         Transform transform = bodyObject.transform.Find(jointType.ToString());
         transform.localPosition = BodySourceView.GetVector3FromJoint(joint);
         LineRenderer component = transform.GetComponent <LineRenderer>();
         if (joint2 != null)
         {
             component.SetPosition(0, transform.localPosition);
             component.SetPosition(1, BodySourceView.GetVector3FromJoint(joint2.Value));
             component.startColor = BodySourceView.GetColorForState(joint.TrackingState);
             component.endColor   = BodySourceView.GetColorForState(joint2.Value.TrackingState);
         }
         else
         {
             component.enabled = false;
         }
     }
 }
コード例 #2
0
    void Start()
    {
        _Sensor = KinectSensor.GetDefault();

        if (_Sensor != null)
        {
            _Reader = _Sensor.ColorFrameSource.OpenReader();

            var frameDesc = _Sensor.ColorFrameSource.CreateFrameDescription(ColorImageFormat.Rgba);

            _Texture = new Texture2D(frameDesc.Width, frameDesc.Height, TextureFormat.RGBA32, false);
            _Data    = new byte[frameDesc.BytesPerPixel * frameDesc.LengthInPixels];

            if (!_Sensor.IsOpen)
            {
                _Sensor.Open();
            }
        }
        else
        {
            Debug.LogError("cannot get Kinect sensor");
        }
        GameObject     bodyView = GameObject.Find("KinectBodyView");
        BodySourceView view     = bodyView.GetComponent <BodySourceView>();

        view.isAHandDetected = false;
    }
コード例 #3
0
    //private GameObject binObject;
    // Use this for initialization
    void Start()
    {
        bodyView   = GameObject.Find("BodyView").GetComponent <BodySourceView>();
        chosenBody = bodyView.getTrackedBody();

        bodySourceView = GameObject.Find("BodyView").GetComponent <BodySourceView>();

        collisionManager = GameObject.Find("CollisionManager").GetComponent <CollisionManager>();
    }
コード例 #4
0
ファイル: machine5.cs プロジェクト: CDulst/BachelorProef
    // Start is called before the first frame update
    void Start()
    {
        GameObject KinectAvatar = GameObject.Find("KinectAvatar");

        scriptBodySourceView = KinectAvatar.GetComponent <BodySourceView>();

        GameObject Velocity = GameObject.Find("VelocityManager");

        scriptVelocity = Velocity.GetComponent <VelocityCalc>();
    }
コード例 #5
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject kinectAvatar = GameObject.Find("KinectAvatar");

        KinectScript = kinectAvatar.GetComponent <BodySourceView>();

        light1 = light1object.GetComponent <Light>();
        light2 = light2object.GetComponent <Light>();
        light3 = light3object.GetComponent <Light>();
        light4 = light4object.GetComponent <Light>();
        light5 = light5object.GetComponent <Light>();
    }
コード例 #6
0
    void Start()
    {
        bsv = GameObject.Find("BodyView").GetComponent<BodySourceView>();
        dicData = new Dictionary<string, List<float[]>>();
        // GameAction.GameAction
        InitDic();

        CollectSinglebutton.onClick.AddListener(() =>
        {
            OnClickCollectSingleData();
        });
        
    }
コード例 #7
0
    void Update()
    {
        if (_Reader != null)
        {
            var frame = _Reader.AcquireLatestFrame();
            if (frame != null)
            {
                if (_Data == null)
                {
                    _Data = new Body[_Sensor.BodyFrameSource.BodyCount];
                }

                frame.GetAndRefreshBodyData(_Data);

                frame.Dispose();
                frame = null;
            }
        }
        if (Input.GetKeyDown("escape"))
        {
            GameObject     bodyView = GameObject.Find("KinectBodyView");
            BodySourceView view     = bodyView.GetComponent <BodySourceView>();
            view.isAHandDetected = false;

            GameObject  confirmCanvas = GameObject.Find("ConfirmCanvas");
            CanvasGroup exitGroup     = confirmCanvas.GetComponent <CanvasGroup>();
            exitGroup.blocksRaycasts = true;
            exitGroup.alpha          = 1;
            exitGroup.interactable   = true;
        }


        if (Input.GetKeyDown("backspace"))
        {
            if (SceneManager.GetActiveScene().name != "ClimbAR_Menu")
            {
                SceneManager.LoadSceneAsync("ClimbAR_Menu", LoadSceneMode.Single);
            }
        }

        if (Input.GetKeyDown("s"))
        {
            Camera.main.cullingMask = LayerMask.NameToLayer("Everything"); // don't show skeleton
        }

        if (Input.GetKeyDown("h"))
        {
            Camera.main.cullingMask &= ~(1 << LayerMask.NameToLayer("Skeleton")); // don't show skeleton
        }
    }
コード例 #8
0
 void Start()
 {
     totalPlayers = GameParameters.instance.GetPlayerCount();
     _bodyView    = GameObject.Find("BodyView").GetComponent <BodySourceView>();
     GetComponent <Button>().onClick.AddListener(delegate
     {
         count       = 0;
         isSelecting = true;
         _bodyView.ResetMarkers();
         PlayersManager.instance.InitPlayers();
         ToSelectUI.text = "Selectionner joueur " + (count + 1) + " / " + _bodyView.GetTrackedBodiesCount();
         GetComponent <Button>().interactable = false;
     });
 }
コード例 #9
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject KinectAvatar = GameObject.Find("KinectAvatar");

        scriptBodySourceView = KinectAvatar.GetComponent <BodySourceView>();

        GameObject Velocity = GameObject.Find("VelocityManager");

        scriptVelocity = Velocity.GetComponent <VelocityCalc>();

        GameObject Table = GameObject.Find("Table");

        tableMovScript = Table.GetComponent <TableMovement>();
    }
コード例 #10
0
    //Making this object a singleton using DontDestroyOnLoad()
    void Awake()
    {
        //To get body isTracked flag from BSV
        BSV = gameObject.GetComponent <BodySourceView>();

        if (control != null)
        {
            Destroy(gameObject);
        }
        else
        {
            control = this;
            DontDestroyOnLoad(gameObject);
        }
    }
コード例 #11
0
    void Start()
    {
        _Actor                   = GameObject.FindGameObjectWithTag("Actor").transform;
        _KinectBody              = FindObjectOfType <BodySourceView>();
        _KinectBody.OnBodyFound += ActivateSequence;
        _KinectBody.OnBodyLost  += DeactivateSequence;

        if (_KinectBody == null)
        {
            Debug.Log("Could not find BodySourceView object in scene");
        }

        _ScanTransform = GameObject.FindGameObjectWithTag("ScanTransform").GetComponent <Transform>();
        _ScanObjects   = _ScanTransform.GetComponentsInChildren <Renderer>();

        if (Application.Instance.EnableStencilMask)
        {
            foreach (Renderer r in _ScanObjects)
            {
                Texture tempTex = r.material.mainTexture;
                r.material             = new Material(Resources.Load("Shaders/StencilRead") as Shader);
                r.material.mainTexture = tempTex;
                r.material.SetColor("_Color", Color.white);
                r.material.SetInt("_StencilRef", 1);
            }
            foreach (GameObject ob in GameObject.FindGameObjectsWithTag("StencilMask"))
            {
                Renderer r = ob.GetComponent <Renderer>();
                r.material = new Material(Resources.Load("Shaders/StencilWrite") as Shader);
                r.material.SetInt("_StencilRef", 1);

                if (Application.Instance.EnableShutters)
                {
                    GameObject shutter = Instantiate(Resources.Load("Prefabs/Shutter"), ob.transform) as GameObject;
                    shutter.name = "Shutter";

                    foreach (Transform child in shutter.GetComponentsInChildren <Transform>())
                    {
                        child.gameObject.layer = ob.layer;
                    }
                }
            }
            if (Application.Instance.EnableShutters)
            {
                _Shutters = FindObjectsOfType <Shutter>();
            }
        }
    }
コード例 #12
0
ファイル: TorqueTest.cs プロジェクト: CDulst/BachelorProef
    // Start is called before the first frame update
    void Start()
    {
        rb       = gameObject.GetComponent <Rigidbody>();
        tunnelRb = tunnel.GetComponent <Rigidbody>();

        GameObject KinectAvatar = GameObject.Find("KinectAvatar");

        scriptBodySourceView = KinectAvatar.GetComponent <BodySourceView>();

        GameObject Velocity = GameObject.Find("VelocityManager");

        scriptVelocity = Velocity.GetComponent <VelocityCalc>();

        GameObject arrow = GameObject.Find("arrow");

        arrowScript = arrow.GetComponent <arrowMovement>();
    }
コード例 #13
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject TriggerController = GameObject.Find("TriggerController");

        TriggerControllerScript = TriggerController.GetComponent <TriggerController>();
        GameObject BodySourceView = GameObject.Find("KinectAvatar");

        BodySourceViewScript = BodySourceView.GetComponent <BodySourceView>();
        GameObject TransitionLoader = GameObject.Find("TransitionLoader");

        transitionScript = TransitionLoader.GetComponent <TransitionLoader>();
        GameObject cubeSpinningAnim = GameObject.Find("Cube");

        //cubeScript = cubeSpinningAnim.GetComponent<CubeSpinningAnimation>();

        animationControl = cameraManagement.GetComponent <PlayableDirector>();
    }
コード例 #14
0
ファイル: SuikaMain.cs プロジェクト: 21411029/ARsuika-kinect
    void OnTriggerEnter(Collider col)
    {
        if (col.tag == "Stick")
        {
            BodySourceView body = GameObject.FindGameObjectWithTag("KinectManagers").GetComponent <BodySourceView>();
            Debug.Log("Hit and Swing=" + body.isSwinging());
            if (body.isSwinging())
            {
                WiimoteController.Instance.SetRumble(0.2f);

                AudioSource stickAudio = col.GetComponent <AudioSource>();
                stickAudio.clip = audioHit;
                stickAudio.time = 0.12f;
                stickAudio.Play();
                this.transform.position = new Vector3(Random.Range(1.5f, 2.0f), 3.0f, -Random.Range(1.5f, 2.0f));
            }
        }
    }
コード例 #15
0
    private void updateLegCoords()
    {
        //Get the coordinates of every points of the right leg.
        Vector3 jointPositionFootRight  = BodySourceView.GetJointLocalPosition(Kinect.JointType.FootRight);
        Vector3 jointPositionAnkleRight = BodySourceView.GetJointLocalPosition(Kinect.JointType.AnkleRight);
        Vector3 jointPositionKneeRight  = BodySourceView.GetJointLocalPosition(Kinect.JointType.KneeRight);
        Vector3 jointPositionHipRight   = BodySourceView.GetJointLocalPosition(Kinect.JointType.HipRight);

        legCoords[0] = jointPositionFootRight[0] - jointPositionHipRight[0];
        legCoords[1] = jointPositionFootRight[1] - jointPositionHipRight[1];
        legCoords[2] = jointPositionFootRight[2] - jointPositionHipRight[2];
        legCoords[3] = jointPositionAnkleRight[0] - jointPositionHipRight[0];
        legCoords[4] = jointPositionAnkleRight[1] - jointPositionHipRight[1];
        legCoords[5] = jointPositionAnkleRight[2] - jointPositionHipRight[2];
        legCoords[6] = jointPositionKneeRight[0] - jointPositionHipRight[0];
        legCoords[7] = jointPositionKneeRight[1] - jointPositionHipRight[1];
        legCoords[8] = jointPositionKneeRight[2] - jointPositionHipRight[2];
    }
コード例 #16
0
ファイル: machine6.cs プロジェクト: CDulst/BachelorProef
    void Start()
    {
        popUp.CreatePopUp();

        GameObject KinectAvatar = GameObject.Find("KinectAvatar");

        scriptBodySourceView = KinectAvatar.GetComponent <BodySourceView>();

        GameObject Velocity = GameObject.Find("VelocityManager");

        scriptVelocity = Velocity.GetComponent <VelocityCalc>();

        GameObject spawnerRight = GameObject.Find("BallspwnerRight");

        scriptBallSpawnerRight = spawnerRight.GetComponent <BallSpwner>();

        GameObject spawnerLeft = GameObject.Find("BallspwnerLeft");

        scriptBallSpawnerLeft = spawnerLeft.GetComponent <BallSpwner>();

        GameObject spawnerBottom = GameObject.Find("BallspwnerBottom");

        scriptBallSpawnerBottom = spawnerBottom.GetComponent <BallSpwner>();
    }
コード例 #17
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject kinect = GameObject.Find("KinectAvatar");

        kinectScript = kinect.GetComponent <BodySourceView>();
    }
コード例 #18
0
    // coroutine for overlaying bounding boxes on color image
    IEnumerator GrabFrameAndClassify(float delay)
    {
        classifyRunning = true;
        Debug.Log("starting classification coroutine");

        GameObject     bodyView = GameObject.Find("KinectBodyView");
        BodySourceView view     = bodyView.GetComponent <BodySourceView>();

        view.isClassifying = true;

        yield return(new WaitForSeconds(delay));

        if (_Reader == null)
        {
            Debug.Log("Using hardcoded bounding boxes or image");
            view.isClassifying = false;
            yield return(null);
        }
        ColorFrame frame = _Reader.AcquireLatestFrame();

        if (frame != null)
        {
            int     numHolds;
            float[] holdsBoundingBoxes;
            int     imageWidth;
            int     imageHeight;

            if (DEBUG)
            {
                Debug.Log("In debug mode; using hardcoded bounding boxes");
                //holdsBoundingBoxes = new int[] { 500, 500, 100, 100, 700, 700, 150, 150 };
                holdsBoundingBoxes = new float[] { 500, 500, 100, 100, 500, 100, 200, 200 };
                numHolds           = holdsBoundingBoxes.Length / 4;

                imageWidth  = 1000;
                imageHeight = 1000;
            }
            else
            {
                // don't apply texture, just load it for classification
                frame.CopyConvertedFrameDataToArray(
                    _Data,
                    ColorImageFormat.Bgra);
                _Texture.LoadRawTextureData(_Data);

                // classify image using OpenCV classifier

                FrameDescription frameDesc = _Sensor
                                             .ColorFrameSource
                                             .CreateFrameDescription(ColorImageFormat.Bgra);
                imageWidth         = frameDesc.Width;
                imageHeight        = frameDesc.Height;
                holdsBoundingBoxes = classifyWithOpenCV(imageWidth, imageHeight);
                if (holdsBoundingBoxes[0] < 0)
                {
                    if (!DEBUG)
                    {
                        frame.Dispose();
                        frame = null;
                    }
                    Debug.LogError("Error with classifying. Exiting coroutine");
                    classifyRunning = false;
                    yield break;
                }
                numHolds = holdsBoundingBoxes.Length / 4;
            }

            float[] projectorBounds = StateManager.instance.getProjectorBounds();
            float[] holdsProjectorTransformed;

            if (!StateManager.instance.debugView)
            {
                holdsProjectorTransformed =
                    ClimbARTransformation.transformOpenCvToUnitySpace(
                        projectorBounds,
                        holdsBoundingBoxes);
            }
            else
            {
                holdsProjectorTransformed = new float[holdsBoundingBoxes.Length];
                for (int i = 0; i < holdsBoundingBoxes.Length; i++)
                {
                    holdsProjectorTransformed[i] = (float)holdsBoundingBoxes[i];
                }
            }

            Debug.Log("instantiating " + numHolds + " holds");

            cleanHandHolds(ref this.handholds);
            this.handholds = ClimbARHandhold.InstantiateHandholds(
                this.Handhold,
                this.mainCam,
                holdsProjectorTransformed);

            // persist holds
            for (int i = 0; i < this.handholds.Length; i++)
            {
                DontDestroyOnLoad(this.handholds[i]);
            }

            if (!DEBUG)
            {
                frame.Dispose();
                frame = null;
            }
        }
        else
        {
            Debug.LogError("Frame was null");
        }

        // release locks for this file and the body source view text
        classifyRunning    = false;
        view.isClassifying = false;
    }
 // Use this for initialization
 void Start()
 {
     bodyViewScript = bodyViewObject.GetComponent <BodySourceView>();
     cameraObject.transform.Rotate(fixedRotation);
 }
コード例 #20
0
 protected void Awake()
 {
     singleton = this;
 }
コード例 #21
0
 // Use this for initialization
 void Start()
 {
     bodySourceView = BodySourceView.GetComponent <BodySourceView>();
     manDestinationPos.Set(0, -1.54f, -1.57f);
     manAI = GameObject.FindGameObjectWithTag("Man").GetComponent <ManAI>();
 }
 // Use this for initialization
 void Start()
 {
     bodyViewScript = bodyViewObject.GetComponent<BodySourceView>();
     cameraObject.transform.Rotate(fixedRotation);
 }
コード例 #23
0
    // Use this for initialization
    void Start()
    {
        bodySourceView = FindObjectOfType <BodySourceView>();

        CreateCurser();
    }
コード例 #24
0
ファイル: BubbleManager.cs プロジェクト: dvalles/BubbleGame
 // Use this for initialization
 void Start()
 {
     bubbleGrow = GetComponent<BubbleGrow>();
     bubbleGrow.enabled = false;
     transform.GetComponentInChildren<ParticleSystem>().enableEmission = false;
     body = bodyView.GetComponent<BodySourceView> ();
     spriteRen = GetComponent<SpriteRenderer>();
     spriteRen.sprite = handSprite;
     camera = targetCam.GetComponent<Camera> ();
     bubblegrow = GetComponent<BubbleGrow>();
     touchStraw = GetComponents<AudioSource>();
     timerCon = timer.GetComponent<Timer>();
     replayButton.GetComponent<BoxCollider2D>().enabled = false;
 }
コード例 #25
0
ファイル: testBody.cs プロジェクト: pe310186/kinectBodyCheck
 // Use this for initialization
 void Start () {
     bodySource = GetComponent<BodySourceView>();
     T_check_flag = false;
     canvas.SetActive(false);
     text = canvas.transform.GetChild(1).gameObject;
 }