private void InstantiateFromCode(Vector3 pos) { panObject = GameObject.CreatePrimitive(PrimitiveType.Quad); panObject.transform.position = pos; panZoom = panObject.AddComponent <HandInteractionPanZoom>(); panObject.AddComponent <NearInteractionTouchable>(); }
/// <summary> /// Instantiates a slate from the default prefab at position, looking at the camera /// </summary> private void InstantiateFromPrefab(Vector3 position) { UnityEngine.Object prefab = AssetDatabase.LoadAssetAtPath(slatePrefabAssetPath, typeof(UnityEngine.Object)); panObject = UnityEngine.Object.Instantiate(prefab) as GameObject; Assert.IsNotNull(panObject); panObject.transform.position = position; panZoom = panObject.GetComponentInChildren <HandInteractionPanZoom>(); Assert.IsNotNull(panZoom); }
private void InstantiateFromCode(Vector3?position = null, Quaternion?rotation = null) { panObject = GameObject.CreatePrimitive(PrimitiveType.Quad); panObject.EnsureComponent <BoxCollider>(); panObject.transform.position = position != null ? (Vector3)position : Vector3.forward; panObject.transform.rotation = rotation != null ? (Quaternion)rotation : Quaternion.identity; panZoom = panObject.AddComponent <HandInteractionPanZoom>(); panObject.AddComponent <NearInteractionTouchable>(); }
/// <summary> /// Instantiates a slate from the default prefab at position and rotation /// </summary> private void InstantiateFromPrefab(Vector3?position = null, Quaternion?rotation = null) { UnityEngine.Object prefab = AssetDatabase.LoadAssetAtPath(slatePrefabAssetPath, typeof(UnityEngine.Object)); panObject = UnityEngine.Object.Instantiate(prefab) as GameObject; Assert.IsNotNull(panObject); panObject.transform.position = position != null ? (Vector3)position : Vector3.forward; panObject.transform.rotation = rotation != null ? (Quaternion)rotation : Quaternion.identity; panZoom = panObject.GetComponentInChildren <HandInteractionPanZoom>(); Assert.IsNotNull(panZoom); }
private void OnEnable() { if (panInputSource == null) { panInputSource = GetComponentInParent <HandInteractionPanZoom>(); } if (panInputSource == null) { Debug.LogError("MoveWithPan did not find a HandInteractionPanZoom to listen to, the component will not work", gameObject); } else { panInputSource.PanUpdated.AddListener(OnPanning); } }
private void OnEnable() { rd = GetComponent <Renderer>(); if (panInputSource == null) { panInputSource = GetComponentInChildren <HandInteractionPanZoom>(); } if (panInputSource == null) { Debug.LogError("RotateWithPan did not find a HandInteractionPanZoom to listen to, the component will not work", gameObject); } else { panInputSource.PanStarted.AddListener(OnPanStarted); panInputSource.PanStopped.AddListener(OnPanEnded); panInputSource.PanUpdated.AddListener(OnPanning); } }