Exemplo n.º 1
0
    public Vector3 GetHeadPosition()
    {
        if (InputRayUtils.TryGetRay(headTuple.Item1, headTuple.Item2, out Ray headRay))
        {
            return(headRay.origin + headRay.direction);
        }

        else
        {
            return(vectorNull);
        }
    }
Exemplo n.º 2
0
        void Update()
        {
            StringBuilder sb = new StringBuilder();

            foreach (var tuple in inputSources)
            {
                var sourceType = tuple.Item1;
                var handedness = tuple.Item2;
                sb.Append(sourceType.ToString() + " ");
                if (handedness != Handedness.Any)
                {
                    sb.Append(handedness.ToString());
                }
                sb.Append(": ");
                Ray myRay;
                if (InputRayUtils.TryGetRay(sourceType, handedness, out myRay))
                {
                    sb.Append($"pos: ({myRay.origin.x:F2}, {myRay.origin.y:F2}, {myRay.origin.z:F2}");
                    sb.Append($" forward: ({myRay.direction.x:F2}, {myRay.direction.y:F2}, {myRay.direction.z:F2}");
                }
                else
                {
                    sb.Append(" not available");
                }
                sb.AppendLine();
            }
            inputUtilsText.text = sb.ToString();

            // Iterate through all controllers output position, rotation, and other data from input
            // mappings on a controller.
            sb.Clear();
            foreach (var controller in CoreServices.InputSystem.DetectedControllers)
            {
                sb.AppendLine("Inputs for " + controller.InputSource.SourceName);
                sb.AppendLine();
                // Interactions for a controller is the list of inputs that this controller exposes
                foreach (MixedRealityInteractionMapping inputMapping in controller.Interactions)
                {
                    sb.AppendLine("\tDescription: " + inputMapping.Description);
                    sb.Append("\tAxisType: " + inputMapping.AxisType);
                    sb.Append("\tInputType: " + inputMapping.InputType);
                    sb.Append("\tPositionData: " + inputMapping.PositionData);
                    sb.Append("\tRotationData: " + inputMapping.RotationData);
                    sb.Append("\tBoolData: " + inputMapping.BoolData);
                    sb.Append("\tFloatData: " + inputMapping.FloatData);
                    sb.AppendLine();
                    sb.AppendLine();
                }
                sb.AppendLine();
            }
            rawDataText.text = sb.ToString();
        }
Exemplo n.º 3
0
        public void Update()
        {
            Ray myRay;

            if (InputRayUtils.TryGetRay(sourceType, handedness, out myRay))
            {
                transform.localPosition = myRay.origin;
                transform.localRotation = Quaternion.LookRotation(myRay.direction, Vector3.up);
                SetIsDataAvailable(true);
            }
            else
            {
                SetIsDataAvailable(false);
            }
        }