Exemplo n.º 1
0
        // TRUE: Si parte 1 esta a la izquierda de parte 2
        // Presicion, refiere a datos reales enviados por el dispositivo
        public override bool cumple(HumanSkeleton hS)
        {
            HumanBodyPart p1 = hS.getBodyPart(part1);
            HumanBodyPart p2 = hS.getBodyPart(part2);

            return((p2.X - p1.X) > presicion);
        }
        public override bool cumple(HumanSkeleton hS1, HumanSkeleton hS2)
        {
            HumanBodyPart p1 = hS1.getBodyPart(part1);
            HumanBodyPart p2 = hS2.getBodyPart(part2);

            return(Math.Abs(p1.Z - p2.Z) < presicion);
        }
Exemplo n.º 3
0
        public void SendHapticFeedback(HumanBodyPart handType)
        {
            if (!settings.allowVibration)
            {
                return;
            }
            switch (handType)
            {
            case HumanBodyPart.LeftHand:
                if (_leftHandImpulses.Count >= 1 && !settings.allowVibrationStacking)
                {
                    return;
                }
                _leftHandImpulses.Push(HapticSignal.Default);
                break;

            case HumanBodyPart.RightHand:
                if (_rightHandImpulses.Count >= 1 && !settings.allowVibrationStacking)
                {
                    return;
                }
                _rightHandImpulses.Push(HapticSignal.Default);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(handType), handType, null);
            }
        }
Exemplo n.º 4
0
        // TRUE: Si parte 1 esta en el mismo valor de x que la parte 2
        // Presicion, refiere a datos reales enviados por el dispositivo y aca a valores chicos de presicion mayor es la precision.
        public override bool cumple(HumanSkeleton hS)
        {
            HumanBodyPart p1 = hS.getBodyPart(part1);
            HumanBodyPart p2 = hS.getBodyPart(part2);

            return(Math.Abs(p1.X - p2.X) < precision);
        }
Exemplo n.º 5
0
        public override bool cumple(HumanSkeleton hS1, HumanSkeleton hS2)
        {
            HumanBodyPart p1 = hS1.getBodyPart(part1);
            HumanBodyPart p2 = hS2.getBodyPart(part2);

            return((p2.Y - p1.Y) > presicion);
        }
        //Se calcula la posición relativa al torso.
        public override bool cumple(HumanSkeleton hS)
        {
            HumanBodyPart p1    = hS.getBodyPart(part1);
            HumanBodyPart torso = hS.getBodyPart("Torso");

            return(true);
        }
 private void UpdateDrawDepths(HumanBodyPart currentBodyPart, int currentDrawDepth = 0)
 {
     currentBodyPart.DrawDepth = currentDrawDepth;
     foreach (HumanBodyPart bodyPart in currentBodyPart.SubParts)
     {
         UpdateDrawDepths(bodyPart, currentDrawDepth + 1);
     }
 }
Exemplo n.º 8
0
        private void Update()
        {
            if (Input.GetKeyDown(KeyCode.Tab))
            {
                _controlledHand = _controlledHand == HumanBodyPart.LeftHand
                    ? HumanBodyPart.RightHand
                    : HumanBodyPart.LeftHand;
            }

            if (Input.GetKey(ControlCamera))
            {
                var transform1 = Camera.main.transform;

                if (Input.GetKey(CameraForward))
                {
                    transform1.position += transform1.forward * cameraSpeed;
                }

                if (Input.GetKey(cameraBack))
                {
                    transform1.position += -1 * cameraSpeed * transform1.forward;
                }

                if (Input.GetKey(cameraLeft))
                {
                    transform1.position += -1 * cameraSpeed * transform1.right;
                }

                if (Input.GetKey(cameraRight))
                {
                    transform1.position += transform1.right * cameraSpeed;
                }
                if (Input.GetKey(cameraUp))
                {
                    transform1.position += transform1.up * cameraSpeed;
                }
                if (Input.GetKey(cameraDown))
                {
                    transform1.position += transform1.up * -cameraSpeed;
                }

                if (Input.GetMouseButton((int)MouseButton.RightMouse))
                {
                    yaw   += speedH * Input.GetAxis("Mouse X");
                    pitch -= speedV * Input.GetAxis("Mouse Y");

                    transform1.eulerAngles = new Vector3(pitch, yaw, 0.0f);
                }

                return;
            }
            else
            {
                UpdateTrackingInformations(_controlledHand == HumanBodyPart.RightHand ? RightHandInputDevice : LeftHandInputDevice);
            }

            _lastMousePos = Input.mousePosition;
        }
        private void update(HumanSkeleton hS)
        {
            HumanBodyPart p1 = hS.getBodyPart(part1);
            HumanBodyPart p2 = hS.getBodyPart(part2);
            HumanBodyPart p3 = hS.getBodyPart(part3);

            v1.set(p1.X - p2.X, p1.Y - p2.Y, p1.Z - p2.Z);
            v2.set(p3.X - p2.X, p3.Y - p2.Y, p3.Z - p2.Z);
        }
Exemplo n.º 10
0
        public float getDistance(HumanSkeleton hS1, HumanSkeleton hS2)
        {
            HumanBodyPart p1       = hS1.getBodyPart(part1);
            HumanBodyPart p2       = hS2.getBodyPart(part2);
            double        partialX = Math.Pow(p1.X - p2.X, 2);
            double        partialY = Math.Pow(p1.Y - p2.Y, 2);
            double        partialZ = Math.Pow(p1.Z - p2.Z, 2);

            return((float)Math.Sqrt(partialX + partialY + partialZ));
        }
    private void Start()
    {
        HumanBodyPart subSubSubBodyPart = new HumanBodyPart("SubSubSubBodyPart", new HumanBodyPart[] { });
        HumanBodyPart subSubBodyPart1   = new HumanBodyPart("SubSubBodyPart1", new HumanBodyPart[] { subSubSubBodyPart });
        HumanBodyPart subSubBodyPart2   = new HumanBodyPart("SubSubBodyPart2", new HumanBodyPart[] { });
        HumanBodyPart subBodyPart       = new HumanBodyPart("SubBodyPart", new HumanBodyPart[] { subSubBodyPart1, subSubBodyPart2 });

        mainBodyPart = new HumanBodyPart("BodyPart", new HumanBodyPart[] { subBodyPart });
        UpdateDrawDepths(mainBodyPart);
    }
    private void OnGUI()
    {
        HumanBodyPart testBodyPart = new HumanBodyPart();

        testBodyPart.EnglishTitle = "BodyPart";
        testBodyPart.SubParts     = new List <HumanBodyPart>();
        HumanBodyPart subBodyPart = new HumanBodyPart();

        subBodyPart.EnglishTitle = "SubBodyPart";
        subBodyPart.SubParts     = new List <HumanBodyPart>();
        testBodyPart.SubParts.Add(subBodyPart);
        GUI.Label(new Rect(text.transform.position.x + 30, text.transform.position.y, 200, 20), testBodyPart.EnglishTitle);
        if (GUI.Button(new Rect(text.transform.position.x, text.transform.position.y, 20, 20), "+"))
        {
            shouldShowSubparts = true;
        }
        if (shouldShowSubparts)
        {
            ShowSubPartsOnClick(text.transform.position.x, text.transform.position.y, 200, 20, testBodyPart);
        }
    }
    private void OnGUI()
    {
        float spacing   = 30;
        float x         = text.transform.position.x + spacing;
        float y         = text.transform.position.y;
        int   drawDepth = 0;
        List <HumanBodyPart> nextPartsToRender = new List <HumanBodyPart>(new HumanBodyPart[] { mainBodyPart });

        while (nextPartsToRender.Count > 0)
        {
            HumanBodyPart currentPart = nextPartsToRender[0];
            GUI.Label(new Rect(currentPart.DrawDepth * spacing + x, y, 200, 20), currentPart.EnglishTitle);
            nextPartsToRender.RemoveAt(0);
            if (GUI.Button(new Rect(x - spacing + currentPart.DrawDepth * spacing, y, 20, 20), "+"))
            {
                currentPart.IsExpanded = true;
            }
            if (currentPart.IsExpanded)
            {
                nextPartsToRender.InsertRange(0, currentPart.SubParts);
            }
            y += spacing;
        }
    }
Exemplo n.º 14
0
 public PlayerHandInputDevice(HumanBodyPart part, XrGeneralSettings settings)
 {
     TrackingInformation    = new TrackingInformation(part);
     InteractionInformation = new InteractionInformation(part, settings);
 }
Exemplo n.º 15
0
 public TrackingInformation(HumanBodyPart part)
 {
     Part = part;
 }
 private void ShowSubPartsOnClick(float x, float y, float widthLABEL, float heigth, HumanBodyPart bodyPart)
 {
     x = x + 14;
     for (int i = 0; i < bodyPart.SubParts.Count; i++)
     {
         Debug.Log(bodyPart.SubParts[i].EnglishTitle);
         y = y + 14;
         GUI.Label(new Rect(x + 14, y, widthLABEL, heigth), bodyPart.SubParts[i].EnglishTitle);
         if (GUI.Button(new Rect(x, y, 14, heigth), "+"))
         {
             ShowSubPartsOnClick(x, y, widthLABEL, heigth, bodyPart.SubParts[i]);
         }
     }
 }
 public InteractionInformation(HumanBodyPart part, XrGeneralSettings settings)
 {
     _settings = settings;
     Part      = part;
 }
Exemplo n.º 18
0
 public void SendHapticFeedback(HumanBodyPart handType)
 {
 }