void Update() { if (IsActive()) { if (!m_Initialized) { if (GameObject.Find("VRManager").GetComponent <VRManagerScript>().VRSystemCenterNode != null) { m_VRSystemCenterNode = GameObject.Find("VRManager").GetComponent <VRManagerScript>().VRSystemCenterNode.transform; } else { vrNode3D vrSystemMVRNode = MiddleVR.VRDisplayMgr.GetNodeByTag(MiddleVR.VR_SYSTEM_CENTER_NODE_TAG); if (vrSystemMVRNode != null) { m_VRSystemCenterNode = GameObject.Find(vrSystemMVRNode.GetName()).transform; } } m_Initialized = true; } if (ElasticRepresentationPrefab == null) { MVRTools.Log("[X] VRInteractionNavigationElastic error: bad elastic prefab reference"); return; } if (m_it.HasNavigationStarted()) { m_ElasticRepresentationObject = (GameObject)GameObject.Instantiate(ElasticRepresentationPrefab); m_ElasticRepresentationObject.transform.parent = m_VRSystemCenterNode; m_ElasticRepresentation = m_ElasticRepresentationObject.GetComponent <VRElasticRepresentation>(); UpdateElasticRepresentation(); } else if (m_it.IsNavigationRunning()) { UpdateElasticRepresentation(); } else if (m_it.IsNavigationStopped() && m_ElasticRepresentation != null) { GameObject.Destroy(m_ElasticRepresentationObject); } } }
// Update is called once per frame void Update() { // Nothing to do for this interaction, everything is done in the kernel if (!m_Initialized) { if (GameObject.Find("VRManager").GetComponent <VRManagerScript>().RootNode != null) { m_VRRootNode = GameObject.Find("VRManager").GetComponent <VRManagerScript>().RootNode.transform; } m_Initialized = true; } if (ElasticRepresentationPrefab == null) { MiddleVRTools.Log("[X] VRInteractionNavigationElastic error: bad elastic prefab reference"); return; } if (m_it.HasNavigationStarted()) { m_ElasticRepresentationObject = (GameObject)GameObject.Instantiate(ElasticRepresentationPrefab); m_ElasticRepresentationObject.transform.parent = m_VRRootNode; m_ElasticRepresentation = m_ElasticRepresentationObject.GetComponent <VRElasticRepresentation>(); UpdateElasticRepresentation(); } else if (m_it.IsNavigationRunning()) { UpdateElasticRepresentation(); } else if (m_it.IsNavigationStopped() && m_ElasticRepresentation != null) { GameObject.Destroy(m_ElasticRepresentationObject); } }
protected void Update() { if (IsActive()) { if (!m_Initialized) { if (GameObject.Find("VRManager").GetComponent<VRManagerScript>().VRSystemCenterNode != null) { m_VRSystemCenterNode = GameObject.Find("VRManager").GetComponent<VRManagerScript>().VRSystemCenterNode.transform; } else { vrNode3D vrSystemMVRNode = MiddleVR.VRDisplayMgr.GetNodeByTag(MiddleVR.VR_SYSTEM_CENTER_NODE_TAG); if (vrSystemMVRNode != null) { m_VRSystemCenterNode = GameObject.Find(vrSystemMVRNode.GetName()).transform; } } m_Initialized = true; } if (ElasticRepresentationPrefab == null) { MVRTools.Log("[X] VRInteractionNavigationElastic error: bad elastic prefab reference"); return; } if (m_it.HasNavigationStarted()) { m_ElasticRepresentationObject = (GameObject)GameObject.Instantiate(ElasticRepresentationPrefab); m_ElasticRepresentationObject.transform.parent = m_VRSystemCenterNode; m_ElasticRepresentation = m_ElasticRepresentationObject.GetComponent<VRElasticRepresentation>(); UpdateElasticRepresentation(); } else if (m_it.IsNavigationRunning()) { UpdateElasticRepresentation(); } else if (m_it.IsNavigationStopped() && m_ElasticRepresentation != null) { GameObject.Destroy(m_ElasticRepresentationObject); } } }