Example #1
0
        private void LateUpdate()
        {
            if (!IsInitialized || !_hand.IsInitialized)
            {
                return;
            }
            if (_skeleton.activeSelf != EnableVisualization)
            {
                _skeleton.SetActive(EnableVisualization);
            }
            if (!EnableVisualization)
            {
                return;
            }
            float width = LINE_RENDERER_WIDTH * _hand.State.HandScale;

            //Update bone connectors
            for (int i = 0; i < _boneConnectorsVisualizers.Count; i++)
            {
                _boneConnectorsVisualizers[i].Line.SetPosition(0, _boneConnectorsVisualizers[i].StartBone.transform.position);
                _boneConnectorsVisualizers[i].Line.SetPosition(1, _boneConnectorsVisualizers[i].EndSphere.transform.position);
                _boneConnectorsVisualizers[i].Line.startWidth = width;
                _boneConnectorsVisualizers[i].Line.endWidth   = width;
            }
            //set alpha
            var alpha = _hand.ScaledAlpha > 0.5f ? 1.0f : Mathf.Clamp(_hand.ScaledAlpha, 0.0f, 1.0f);

            _skeletonMaterial.SetFloat(HAND_ALPHA_ID, alpha);
            //Update material to identify trigger of system gesture.
            _handMaterialModifier.UpdateHandMaterial(_hand, _skeletonMaterial);
        }
Example #2
0
        public void UpdatePose()
        {
            bool showHandMesh = _enableMeshVisual ? _hand.IsTracked : _enableMeshVisual;

            if (HandSkinedMeshRenderer.enabled != showHandMesh)
            {
                HandSkinedMeshRenderer.enabled = showHandMesh;
            }
            // getting alpha value according to current scaled value and current allowed max alpha value.
            var scaledValue = Mathf.Clamp(_hand.ScaledAlpha, 0.0f, _currentAlphaMax);

            _material.SetFloat(_handAlphaId, scaledValue);
            // Update hand material according to system gesture state
            _handMaterialModifier.UpdateHandMaterial(_hand, _material);
        }