Example #1
0
        //-------------------------------------------------
        protected void OnParentHandHoverBegin(IF_VR_Steam_Interactable other)
        {
            if (!this.isActiveAndEnabled)
            {
                return;
            }

            if (other.transform.parent != transform.parent)
            {
                ShowHighlight();
            }
        }
Example #2
0
        //-------------------------------------------------
        protected virtual void Awake()
        {
            velocityEstimator = GetComponent <IF_VR_Steam_VelocityEstimator>();
            interactable      = GetComponent <IF_VR_Steam_Interactable>();



            rigidbody = GetComponent <Rigidbody>();
            rigidbody.maxAngularVelocity = 50.0f;


            if (attachmentOffset != null)
            {
                // remove?
                //interactable.handFollowTransform = attachmentOffset;
            }
        }
Example #3
0
 //-------------------------------------------------
 private void OnParentHandHoverEnd(IF_VR_Steam_Interactable other)
 {
     HideHighlight();
 }
        //-------------------------------------------------
        void Awake()
        {
            interactable = GetComponentInParent <IF_VR_Steam_Interactable>();

            //
            // Create child game object for see thru renderer
            //
            seeThru = new GameObject("_see_thru");
            seeThru.transform.parent        = transform;
            seeThru.transform.localPosition = Vector3.zero;
            seeThru.transform.localRotation = Quaternion.identity;
            seeThru.transform.localScale    = Vector3.one;

            //
            // Copy mesh filter
            //
            MeshFilter sourceMeshFilter = GetComponent <MeshFilter>();

            if (sourceMeshFilter != null)
            {
                MeshFilter destMeshFilter = seeThru.AddComponent <MeshFilter>();
                destMeshFilter.sharedMesh = sourceMeshFilter.sharedMesh;
            }

            //
            // Copy mesh renderer
            //
            MeshRenderer sourceMeshRenderer = GetComponent <MeshRenderer>();

            if (sourceMeshRenderer != null)
            {
                sourceRenderer = sourceMeshRenderer;
                destRenderer   = seeThru.AddComponent <MeshRenderer>();
            }

            //
            // Copy skinned mesh renderer
            //
            SkinnedMeshRenderer sourceSkinnedMeshRenderer = GetComponent <SkinnedMeshRenderer>();

            if (sourceSkinnedMeshRenderer != null)
            {
                SkinnedMeshRenderer destSkinnedMeshRenderer = seeThru.AddComponent <SkinnedMeshRenderer>();

                sourceRenderer = sourceSkinnedMeshRenderer;
                destRenderer   = destSkinnedMeshRenderer;

                destSkinnedMeshRenderer.sharedMesh          = sourceSkinnedMeshRenderer.sharedMesh;
                destSkinnedMeshRenderer.rootBone            = sourceSkinnedMeshRenderer.rootBone;
                destSkinnedMeshRenderer.bones               = sourceSkinnedMeshRenderer.bones;
                destSkinnedMeshRenderer.quality             = sourceSkinnedMeshRenderer.quality;
                destSkinnedMeshRenderer.updateWhenOffscreen = sourceSkinnedMeshRenderer.updateWhenOffscreen;
            }

            //
            // Create see thru materials
            //
            if (sourceRenderer != null && destRenderer != null)
            {
                int        materialCount         = sourceRenderer.sharedMaterials.Length;
                Material[] destRendererMaterials = new Material[materialCount];
                for (int i = 0; i < materialCount; i++)
                {
                    destRendererMaterials[i] = seeThruMaterial;
                }
                destRenderer.sharedMaterials = destRendererMaterials;

                for (int i = 0; i < destRenderer.materials.Length; i++)
                {
                    destRenderer.materials[i].renderQueue = 2001;                     // Rendered after geometry
                }

                for (int i = 0; i < sourceRenderer.materials.Length; i++)
                {
                    if (sourceRenderer.materials[i].renderQueue == 2000)
                    {
                        sourceRenderer.materials[i].renderQueue = 2002;
                    }
                }
            }

            seeThru.gameObject.SetActive(false);
        }
 private void Awake()
 {
     interactable = this.GetComponent <IF_VR_Steam_Interactable>();
 }
 protected virtual void Awake()
 {
     mappingChangeSamples = new float[numMappingChangeSamples];
     interactable         = GetComponent <IF_VR_Steam_Interactable>();
 }
 private void Start()
 {
     initialScale = transform.localScale;
     interactable = GetComponent <IF_VR_Steam_Interactable>();
 }