protected virtual void OnPlaneUpdated(ARKPlane _plane) { if (m_planePrefab) { CreateOrUpdatePlaneGameObject(_plane); } }
/// <summary> /// Method used to do a safe call of the 'onPlaneRemoved' delegate. /// </summary> protected void OnPlaneRemoved(ARKPlane _plane) { if (onPlaneRemoved != null) { onPlaneRemoved(_plane); } }
/// <summary> /// Method used to do a safe call of the 'onPlaneUpdated' delegate. /// </summary> protected void OnPlaneUpdated(ARKPlane _plane) { if (onPlaneUpdated != null) { onPlaneUpdated(_plane); } }
protected virtual void OnPlaneRemoved(ARKPlane _plane) { GameObject go; if (m_planes.TryGetValue(_plane.id, out go)) { Destroy(go); m_planes.Remove(_plane.id); } }
protected virtual void CreateOrUpdatePlaneGameObject(ARKPlane _plane) { GameObject go; if (!m_planes.TryGetValue(_plane.id, out go)) { go = Instantiate(m_planePrefab, GetRoot()); //Viewer contains colliders, we need to assign the correct layer for Raycasts foreach (var col in go.GetComponentsInChildren <Collider>()) { col.gameObject.layer = m_planeLayer; } m_planes.Add(_plane.id, go); } go.transform.localPosition = _plane.center; go.transform.localRotation = _plane.rotation; go.transform.localScale = new Vector3(_plane.extents.x, 1f, _plane.extents.y); }