Beispiel #1
0
        protected override void UpdateFoot(LegSensor legSensor)
        {
            legSensor.foot.position = Target.ToVector(Kinect2Tracker.SmoothPosition(lastFootPosition, legSensor.foot.position));
            legSensor.foot.rotation = Target.ToRotation(Kinect2Tracker.SmoothRotation(lastFootRotation, legSensor.foot.rotation));
            base.UpdateFoot(legSensor);

            lastFootPosition = footTarget.foot.target.transform.position;
            lastFootRotation = footTarget.foot.target.transform.rotation;
        }
Beispiel #2
0
        protected override void UpdateLowerLeg(LegSensor legSensor)
        {
            legSensor.lowerLeg.position = Target.ToVector(Kinect2Tracker.SmoothPosition(lastLowerLegPosition, legSensor.lowerLeg.position));
            legSensor.lowerLeg.rotation = Target.ToRotation(Kinect2Tracker.SmoothRotation(lastLowerLegRotation, legSensor.lowerLeg.rotation));
            base.UpdateLowerLeg(legSensor);

            lastLowerLegPosition = footTarget.lowerLeg.target.transform.position;
            lastLowerLegRotation = footTarget.lowerLeg.target.transform.rotation;
        }
        protected virtual void UpdateUpperLeg(LegSensor legSensor)
        {
            if (footTarget.upperLeg.target.transform != null)
            {
                if (legSensor.upperLeg.confidence.position > 0)
                {
                    footTarget.upperLeg.target.transform.position = HumanoidTarget.ToVector3(legSensor.upperLeg.position);
                }
                //else
                // footTarget.upperLeg.target.transform.position = footTarget.shoulder.target.transform.position + footTarget.shoulder.target.transform.rotation * footTarget.outward * footTarget.shoulder.bone.length;

                if (legSensor.upperLeg.confidence.rotation > 0)
                {
                    footTarget.upperLeg.target.transform.rotation = HumanoidTarget.ToQuaternion(legSensor.upperLeg.rotation);
                }

                footTarget.upperLeg.target.confidence = legSensor.upperLeg.confidence;
            }
        }
        protected virtual void UpdateFoot(LegSensor legSensor)
        {
            if (footTarget.foot.target.transform != null)
            {
                if (legSensor.foot.confidence.position > 0)
                {
                    footTarget.foot.target.transform.position = HumanoidTarget.ToVector3(legSensor.foot.position);
                }
                else
                {
                    footTarget.foot.target.transform.position = footTarget.lowerLeg.target.transform.position + footTarget.lowerLeg.target.transform.rotation * Vector3.down * footTarget.lowerLeg.bone.length;
                }

                if (legSensor.foot.confidence.rotation > 0)
                {
                    footTarget.foot.target.transform.rotation = HumanoidTarget.ToQuaternion(legSensor.foot.rotation);
                }

                footTarget.foot.target.confidence = legSensor.foot.confidence;
            }
        }