Ejemplo n.º 1
0
        void Update()
        {
            if (BodySourceManager == null)
            {
                return;
            }

            _bodyManager = BodySourceManager.GetComponent <VRKinectBodySource>();
            if (_bodyManager == null)
            {
                return;
            }

            Kinect.Body[] data = _bodyManager.GetData();
            if (data != null)
            {
                var body = ClosestBody(data);
                if (body != null)
                {
                    if (body.IsTracked)
                    {
                        Joint[0].transform.localPosition = GetVector3FromJoint(body.Joints[Kinect.JointType.Head]);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private Body GetKinectBody()
        {
            if (_sourceManager == null)
            {
                return(null);
            }

            if (_bodySource == null)
            {
                _bodySource = _sourceManager.GetComponent <VRKinectBodySource>();
            }

            if (_bodySource == null)
            {
                return(null);
            }

            Body[] kinectBodies = _bodySource.GetData();
            if (kinectBodies == null)
            {
                return(null);
            }

            var kinectBody = kinectBodies[_bodyIndex];

            return(kinectBody);
        }
Ejemplo n.º 3
0
        //SpineBase 0
        //SpineMid 1
        //Neck 2
        //Head 3
        //ShoulderLeft 4
        //ElbowLeft 5
        //WristLeft 6
        //HandLeft 7
        //ShoulderRight 8
        //ElbowRight 9
        //WristRight 10
        //HandRight 11
        //HipLeft 12
        //KneeLeft 13
        //AnkleLeft 14
        //FootLeft 15
        //HipRight 16
        //KneeRight 17
        //AnkleRight 18
        //FootRight 19
        //SpineShoulder 20
        //HandTipLeft 21
        //ThumbLeft 22
        //HandTipRight 23
        //ThumbRight 24

        void Start()
        {
            _sourceManager = gameObject.transform.parent.gameObject;

            if (_sourceManager != null)
            {
                _bodySource = _sourceManager.GetComponent <VRKinectBodySource>();
            }

            _vrWorldManager = gameObject.GetComponentInParent <VRWorldManager>();

            InitializeRotations();
        }
Ejemplo n.º 4
0
        void Start()
        {
            _kinectBodySource = gameObject.transform.parent.gameObject;

            if (_kinectBodySource != null)
            {
                _bodySourceManager = _kinectBodySource.GetComponent <VRKinectBodySource>();
            }

            _vrWorldManager = gameObject.GetComponentInParent <VRWorldManager>();

            _fromKinecttoUnity[0, 0] = -1;
            _fromKinecttoUnity[1, 1] = 1;
            _fromKinecttoUnity[2, 2] = 1;
        }
Ejemplo n.º 5
0
 void Start()
 {
     _bodySource = gameObject.GetComponent <VRKinectBodySource>();
 }