// Try to select this object.
        private void Select()
        {
            if (ObjectManipulationPointer.IsObjectSelected())
            {
                return;
            }
            // This can be null in start, so let's just check here.
            if (automaticallyAssignPointer)
            {
                if (GvrPointerInputModule.Pointer != null)
                {
                    controlTransform = GvrPointerInputModule.Pointer.PointerTransform;
                }
            }

            if (controlTransform == null)
            {
                return;
            }

            // Only select the object if it's in the correct state, and the state didn't change this frame.
            if (state != ObjectState.None || lastStateChangeFrame == Time.frameCount)
            {
                return;
            }

            OnSelect();
        }
Example #2
0
        void Update()
        {
            if (!ObjectManipulationPointer.IsObjectSelected() && interactiveObject.Hover)
            {
                targetHighlight = 1f;
            }
            else
            {
                targetHighlight = 0f;
            }

            highlight = Mathf.Lerp(highlight, targetHighlight, Time.deltaTime * highlightSpeed);
            materialPropertyBlock.SetFloat(highlightID, highlight);
            meshRenderer.SetPropertyBlock(materialPropertyBlock);
        }