bool HitTestWithResultType(ARPoint point, ARHitTestResultType resultTypes) { var overScene = CanvasManager.SCENE_UNDER_CANVAS; List <ARHitTestResult> hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest(point, resultTypes); if (hitResults.Count > 0 && !mapWasShown && planeAppeared && !overScene) { mapWasShown = true; foreach (var hitResult in hitResults) { m_HitTransform.position = UnityARMatrixOps.GetPosition(hitResult.worldTransform); m_HitTransform.rotation = UnityARMatrixOps.GetRotation(hitResult.worldTransform); m_HitTransform.localScale = new Vector3(resultScale, resultScale, resultScale); Vector3 currAngle = m_HitTransform.eulerAngles; m_HitTransform.LookAt(Camera.main.transform); m_HitTransform.eulerAngles = new Vector3(currAngle.x, m_HitTransform.eulerAngles.y + 180f, currAngle.z); Transform map; for (int i = 0; i < m_HitTransform.childCount; i++) { map = m_HitTransform.GetChild(i); if (map.name == "Map") { MAP = map.gameObject; MAP.GetComponent <Animator>().SetInteger("mapAnimTransition", SHOW_MAP_ANIM); spawnScript = MAP.GetComponent <SpawnOnMap> (); m_HitTransform.gameObject.GetComponent <LeanScale>().enabled = true; if (CanvasController.isFirstSession) { ccontroller.show_info_Button(); } } } generate_script.getManager().HidePrefabs(); ccontroller.hide_about_map_text(); ccontroller.show_screenShot_btn(); ccontroller.show_reload_btn(); return(true); } } return(false); }
public LayerMask collisionLayer = 1 << 10; //ARKitPlane layer bool HitTestWithResultType(ARPoint point, ARHitTestResultType resultTypes) { List <ARHitTestResult> hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest(point, resultTypes); if (hitResults.Count > 0) { foreach (var hitResult in hitResults) { Debug.Log("Got hit!"); m_HitTransform.position = UnityARMatrixOps.GetPosition(hitResult.worldTransform); m_HitTransform.rotation = UnityARMatrixOps.GetRotation(hitResult.worldTransform); Debug.Log(string.Format("x:{0:0.######} y:{1:0.######} z:{2:0.######}", m_HitTransform.position.x, m_HitTransform.position.y, m_HitTransform.position.z)); return(true); } } return(false); }
public LayerMask collisionLayer = 1 << 10; //ARKitPlane layer bool HitTestWithResultType(ARPoint point, ARHitTestResultType resultTypes) { List <ARHitTestResult> hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest(point, resultTypes); // see if any valid places nearby to put kitten if (hitResults.Count > 0) // if there's a valid place to put the kitten { foreach (var hitResult in hitResults) { Debug.Log("Got hit!"); // move the kitten to the first valid position where the user dragged to m_HitTransform.position = UnityARMatrixOps.GetPosition(hitResult.worldTransform); // adjust rotation as necessary m_HitTransform.rotation = UnityARMatrixOps.GetRotation(hitResult.worldTransform); //Debug.Log (string.Format ("x:{0:0.######} y:{1:0.######} z:{2:0.######}", m_HitTransform.position.x, m_HitTransform.position.y, m_HitTransform.position.z)); return(true); } } return(false); }
public static GameObject UpdatePlaneWithAnchorTransform(GameObject plane, ARPlaneAnchor arPlaneAnchor) { //do coordinate conversion from ARKit to Unity plane.transform.position = UnityARMatrixOps.GetPosition(arPlaneAnchor.transform); plane.transform.rotation = UnityARMatrixOps.GetRotation(arPlaneAnchor.transform); MeshFilter mf = plane.GetComponentInChildren <MeshFilter> (); if (mf != null) { //since our plane mesh is actually 10mx10m in the world, we scale it here by 0.1f mf.gameObject.transform.localScale = new Vector3(arPlaneAnchor.extent.x * 0.1f, arPlaneAnchor.extent.y * 0.1f, arPlaneAnchor.extent.z * 0.1f); //convert our center position to unity coords mf.gameObject.transform.localPosition = new Vector3(arPlaneAnchor.center.x, arPlaneAnchor.center.y, -arPlaneAnchor.center.z); } return(plane); }
public static GameObject UpdatePlaneWithAnchorTransform(GameObject plane, ARPlaneAnchor arPlaneAnchor) { //do coordinate conversion from ARKit to Unity Vector3 position = UnityARMatrixOps.GetPosition(arPlaneAnchor.transform); Quaternion rotation = UnityARMatrixOps.GetRotation(arPlaneAnchor.transform); //Transform to placenote frame of reference (planes are detected in ARKit frame of reference) Matrix4x4 worldTransform = Matrix4x4.TRS(position, rotation, Vector3.one); Matrix4x4?placenoteTransform = LibPlacenote.Instance.ProcessPose(worldTransform); if (placenoteTransform == null) //no map related transforms are appropriate { placenoteTransform = worldTransform; } plane.transform.position = PNUtility.MatrixOps.GetPosition(placenoteTransform.Value); plane.transform.rotation = PNUtility.MatrixOps.GetRotation(placenoteTransform.Value); PlacenotePlaneMeshRender ppmr = plane.GetComponent <PlacenotePlaneMeshRender> (); if (ppmr != null) { ppmr.UpdateMesh(arPlaneAnchor); } MeshFilter mf = plane.GetComponentInChildren <MeshFilter> (); if (mf != null) { if (ppmr == null) { //since our plane mesh is actually 10mx10m in the world, we scale it here by 0.1f mf.gameObject.transform.localScale = new Vector3(arPlaneAnchor.extent.x * 0.1f, arPlaneAnchor.extent.y * 0.1f, arPlaneAnchor.extent.z * 0.1f); //convert our center position to unity coords mf.gameObject.transform.localPosition = new Vector3(arPlaneAnchor.center.x, arPlaneAnchor.center.y, -arPlaneAnchor.center.z); } } return(plane); }
/* * * * * * * * Private Methods * * * * * * */ bool HitTestWithResultType(ARPoint point, ARHitTestResultType resultTypes) { List <ARHitTestResult> hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest(point, resultTypes); if (hitResults.Count > 0) { foreach (var hitResult in hitResults) { parentTransform.position = UnityARMatrixOps.GetPosition(hitResult.worldTransform); parentTransform.position += new Vector3(0, 0.1f, 0); parentTransform.rotation = UnityARMatrixOps.GetRotation(hitResult.worldTransform); GetMapMaterialReferences(); SetMapMaterialClipping(); mapPlane = new Plane(m_HitTransform.up, m_HitTransform.position); return(true); } } return(false); }
//private bool test = false; //private Vector3 original = new Vector3(0.025f, 0.025f, 0.025f); //private Vector3 changed = new Vector3(0.05f, 0.05f, 0.05f); bool HitTestWithResultType(ARPoint point, ARHitTestResultType resultTypes) { List <ARHitTestResult> hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest(point, resultTypes); if (hitResults.Count > 0) { Debug.Log("Got hit!"); foreach (var hitResult in hitResults) { m_HitTransform.position = UnityARMatrixOps.GetPosition(hitResult.worldTransform); m_HitTransform.rotation = UnityARMatrixOps.GetRotation(hitResult.worldTransform); Debug.Log(string.Format("HitTest::: x:{0:0.######} y:{1:0.######} z:{2:0.######}", m_HitTransform.position.x, m_HitTransform.position.y, m_HitTransform.position.z)); // Make the portal to always be facing camera on spawn //Vector3 currAngle = transform.eulerAngles; //transform.LookAt(Camera.main.transform); //transform.eulerAngles = new Vector3(currAngle.x, transform.eulerAngles.y, currAngle.z); return(true); } } return(false); }
bool HitTestWithResultType(ARPoint point, ARHitTestResultType resultTypes) { List <ARHitTestResult> hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest(point, resultTypes); if (hitResults.Count > 0) { foreach (var hitResult in hitResults) { GameObject go = new GameObject(); go.transform.position = UnityARMatrixOps.GetPosition(hitResult.worldTransform); Vector3 p = go.transform.position; p.y += 0.3f; go.transform.position = p; go.transform.rotation = UnityARMatrixOps.GetRotation(hitResult.worldTransform); // Create new sphere Instantiate(sphere, go.transform); return(true); } } return(false); }
bool HitTestWithResultType(ARPoint point, ARHitTestResultType resultTypes, GameObject prefab) { List <ARHitTestResult> hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest(point, resultTypes); if (hitResults.Count > 0) { foreach (var hitResult in hitResults) { Debug.Log("Got hit!"); Vector3 pos = UnityARMatrixOps.GetPosition(hitResult.worldTransform); float posy = 0.5f + pos.y; pos = new Vector3(pos.x, posy, pos.z); Quaternion rot = UnityARMatrixOps.GetRotation(hitResult.worldTransform); Instantiate(prefab, pos, rot); // Debug.Log (string.Format ("x:{0:0.######} y:{1:0.######} z:{2:0.######}", m_HitTransform.position.x, m_HitTransform.position.y, m_HitTransform.position.z)); return(true); } } return(false); }
public static GameObject UpdatePlaneWithAnchorTransform(GameObject plane, ARPlaneAnchor arPlaneAnchor) { //do coordinate conversion from ARKit to Unity plane.transform.position = UnityARMatrixOps.GetPosition(arPlaneAnchor.transform); plane.transform.rotation = UnityARMatrixOps.GetRotation(arPlaneAnchor.transform); ARKitPlaneMeshRender apmr = plane.GetComponent <ARKitPlaneMeshRender> (); if (apmr != null) { apmr.UpdateMesh(arPlaneAnchor); } MeshFilter mf = plane.GetComponentInChildren <MeshFilter> (); Vector2 textureScale = plane.GetComponentInChildren <MeshRenderer>().material.mainTextureScale; int textureScaleX = (int)(arPlaneAnchor.extent.x * 50); int textureScaleY = (int)(arPlaneAnchor.extent.z * 50); textureScale = new Vector2(textureScaleX, textureScaleY); plane.GetComponentInChildren <MeshRenderer>().material.mainTextureScale = textureScale; if (mf != null) { if (apmr == null) { //since our plane mesh is actually 10mx10m in the world, we scale it here by 0.1f mf.gameObject.transform.localScale = new Vector3(arPlaneAnchor.extent.x * 0.1f, arPlaneAnchor.extent.y * 0.1f, arPlaneAnchor.extent.z * 0.1f); //convert our center position to unity coords mf.gameObject.transform.localPosition = new Vector3(arPlaneAnchor.center.x, arPlaneAnchor.center.y, -arPlaneAnchor.center.z); } } return(plane); }
bool HitTestWithResultType(ARPoint point, ARHitTestResultType resultTypes) { //平面と当たっていた場合 List <ARHitTestResult> hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest(point, resultTypes); if (hitResults.Count > 0) { foreach (var hitResult in hitResults) { Debug.Log("Got hit!"); if (isCreated == false) { m_HitTransform.position = UnityARMatrixOps.GetPosition(hitResult.worldTransform); m_HitTransform.rotation = UnityARMatrixOps.GetRotation(hitResult.worldTransform); Gametrans.position = UnityARMatrixOps.GetPosition(hitResult.worldTransform); this.gameObject.transform.position = m_HitTransform.position; this.gameObject.transform.rotation = m_HitTransform.rotation; anim = GetComponent <Animator>(); //このスクリプトがアサインされたキャラクターのアニメーターコントローラーを取得 audioSource = GetComponent <AudioSource>(); //AudioSourceを使えるようにする isCreated = true; } //if(Gametrans.position.x > gameObject.transform.position.x && Gametrans.position.z > gameObject.transform.position.z) //{ //transform.position += (Vector3.right * x + Vector3.forward * z) * Time.deltaTime; //} //Debug.Log (string.Format ("x:{0:0.######} y:{1:0.######} z:{2:0.######}", m_HitTransform.position.x, m_HitTransform.position.y, m_HitTransform.position.z)); return(true); } } return(false); }
bool HitTestWithResultType(ARPoint point, ARHitTestResultType resultTypes) { List <ARHitTestResult> hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest(point, resultTypes); if (hitResults.Count > 0) { foreach (var hitResult in hitResults) { Debug.Log("Got hit!"); m_HitTransform.position = UnityARMatrixOps.GetPosition(hitResult.worldTransform); Debug.Log(string.Format("x:{0:0.######} y:{1:0.######} z:{2:0.######}", m_HitTransform.position.x, m_HitTransform.position.y, m_HitTransform.position.z)); m_HitTransform.rotation = UnityARMatrixOps.GetRotation(hitResult.worldTransform); if (IsHorizontal) { Vector3 currAngle = PortalRoom.transform.eulerAngles; PortalRoom.transform.position = FocusEllipse.FoundEllipse.transform.position; //PortalRoom.transform.LookAt (Camera.main.transform); PortalRoom.transform.eulerAngles = new Vector3(currAngle.x, Camera.main.transform.eulerAngles.y, currAngle.z); PortalRoom.SetActive(true); PortalController.OutsidePortal(); } else { Wall.SetActive(true); ResetWall(); CanvasController.ShowResetButton(); } _isPlaced = true; CanvasController.ScanImage.SetActive(false); Debug.Log("Call hide image"); FocusEllipse.IsScanning = false; FocusEllipse.HideFoundEllipse(); return(true); } } return(false); }
bool HitTestWithResultType(ARPoint point, ARHitTestResultType resultTypes) { List <ARHitTestResult> hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest(point, resultTypes); if (hitResults.Count > 0) { foreach (var hitResult in hitResults) { Debug.Log("Got hit!"); m_HitTransform.position = UnityARMatrixOps.GetPosition(hitResult.worldTransform); m_HitTransform.rotation = UnityARMatrixOps.GetRotation(hitResult.worldTransform); transposition = m_HitTransform.position; transorientation = m_HitTransform.rotation; spawnlogo(); //Vector3 relativePosition = transposition - GenerateImageAnchor.GenerateImageAnchorInstance.markerPosition; //Debug.Log (string.Format ("Relative Position: x:{0:0.######} y:{1:0.######} z:{2:0.######}", relativePosition.x, relativePosition.y, relativePosition.z)); //Debug.Log (string.Format(("Rotation: x:{0:0.######} y:{1:0.######} z:{2:0.######}"), transorientation.x, transorientation.y, transorientation.z)); return(true); } } return(false); }
bool HitTestWithResultType(ARPoint point, ARHitTestResultType resultTypes) { List <ARHitTestResult> hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest(point, resultTypes); if (hitResults.Count > 0) { foreach (var hitResult in hitResults) { //pontura: iosCameraManager.PlaneDetectionOFF(); Game game = m_HitTransform.gameObject.GetComponentInChildren <Game> (); game.Init(); done = true; // Debug.Log ("Got hit!"); m_HitTransform.position = UnityARMatrixOps.GetPosition(hitResult.worldTransform); m_HitTransform.rotation = UnityARMatrixOps.GetRotation(hitResult.worldTransform); // Debug.Log (string.Format ("x:{0:0.######} y:{1:0.######} z:{2:0.######}", m_HitTransform.position.x, m_HitTransform.position.y, m_HitTransform.position.z)); return(true); } } return(false); }
bool HitTestWithResultType(ARPoint point, ARHitTestResultType resultTypes) { List <ARHitTestResult> hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest(point, resultTypes); if (hitResults.Count > 0) { foreach (var hitResult in hitResults) { Debug.Log("Got hit!"); m_HitTransform.position = UnityARMatrixOps.GetPosition(hitResult.worldTransform); m_HitTransform.rotation = UnityARMatrixOps.GetRotation(hitResult.worldTransform); // Face the camera (assume it's level and rotate around y-axis only) m_HitTransform.LookAt(Camera.main.transform.position); m_HitTransform.eulerAngles = new Vector3(0, m_HitTransform.eulerAngles.y, 0); Debug.Log(string.Format("x:{0:0.######} y:{1:0.######} z:{2:0.######}", m_HitTransform.position.x, m_HitTransform.position.y, m_HitTransform.position.z)); return(true); } } return(false); }
bool HitTestWithResultType(ARPoint point, ARHitTestResultType resultTypes) { List <ARHitTestResult> hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest(point, resultTypes); if (hitResults.Count > 0) { ScanningDots.SetActive(false); if (!cflBulb.activeInHierarchy) { //works as long as theres only one condition? buildingFact.SetActive(true); buildingFact_trans.SetActive(true); } BlueFocusSquare.SetActive(false); FocusedSquare.SetActive(false); Destroy(FocusedSquare); Destroy(BlueFocusSquare); Destroy(TapToText); foreach (var hitResult in hitResults) { Debug.Log("Got hit!"); m_HitTransform.position = UnityARMatrixOps.GetPosition(hitResult.worldTransform); m_HitTransform.rotation = UnityARMatrixOps.GetRotation(hitResult.worldTransform); Debug.Log(string.Format("x:{0:0.######} y:{1:0.######} z:{2:0.######}", m_HitTransform.position.x, m_HitTransform.position.y, m_HitTransform.position.z)); return(true); } } WholeLamp.transform.DetachChildren(); lampNewCollider.GetComponent <Collider>().enabled = true; return(false); }
public static GameObject UpdatePlaneWithAnchorTransform(GameObject plane, ARPlaneAnchor arPlaneAnchor) { // TANKS CODE if (ARKitGameManager.instance.gameMode != ARKitGameManager.GameMode.Calibration) { return(plane); } ///// //do coordinate conversion from ARKit to Unity plane.transform.position = UnityARMatrixOps.GetPosition(arPlaneAnchor.transform); plane.transform.rotation = UnityARMatrixOps.GetRotation(arPlaneAnchor.transform); ARKitPlaneMeshRender apmr = plane.GetComponent <ARKitPlaneMeshRender> (); if (apmr != null) { apmr.UpdateMesh(arPlaneAnchor); } MeshFilter mf = plane.GetComponentInChildren <MeshFilter> (); if (mf != null) { if (apmr == null) { //since our plane mesh is actually 10mx10m in the world, we scale it here by 0.1f mf.gameObject.transform.localScale = new Vector3(arPlaneAnchor.extent.x * 0.1f, arPlaneAnchor.extent.y * 0.1f, arPlaneAnchor.extent.z * 0.1f); //convert our center position to unity coords mf.gameObject.transform.localPosition = new Vector3(arPlaneAnchor.center.x, arPlaneAnchor.center.y, -arPlaneAnchor.center.z); } } return(plane); }
bool HitTestWithResultType(ARPoint point, ARHitTestResultType resultTypes) { List <ARHitTestResult> hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest(point, resultTypes); if (hitResults.Count > 0) { foreach (var hitResult in hitResults) { Debug.Log("Got hit!"); // spawn Portal GameObject newPortal = Instantiate(portalPrefab); newPortal.transform.position = UnityARMatrixOps.GetPosition(hitResult.worldTransform); newPortal.transform.rotation = UnityARMatrixOps.GetRotation(hitResult.worldTransform); portalAnim = newPortal.GetComponent <Animator>(); // spawn Fractal GameObject newFractal = Instantiate(fractalPrefab); newFractal.transform.position = newPortal.transform.position; newFractal.transform.rotation = newPortal.transform.rotation; fractalAnim = newFractal.GetComponent <Animator>(); /* * m_HitTransform.position = UnityARMatrixOps.GetPosition (hitResult.worldTransform); * m_HitTransform.rotation = UnityARMatrixOps.GetRotation (hitResult.worldTransform); * Debug.Log (string.Format ("x:{0:0.######} y:{1:0.######} z:{2:0.######}", m_HitTransform.position.x, m_HitTransform.position.y, m_HitTransform.position.z)); */ return(true); } } return(false); }
bool HitTestWithResultType(ARPoint point, ARHitTestResultType resultTypes) { if (_isPlaneisPlaced) { return(false); } List <ARHitTestResult> hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest(point, resultTypes); if (hitResults.Count > 0) { foreach (var hitResult in hitResults) { Debug.Log("Got hit!"); m_HitTransform.position = UnityARMatrixOps.GetPosition(hitResult.worldTransform); m_HitTransform.rotation = UnityARMatrixOps.GetRotation(hitResult.worldTransform); _gameContent.SetActive(true); _isPlaneisPlaced = true; _ARCameraManager.TurnOffPlaneDetection(); return(true); } } return(false); }
bool HitTestWithResultType(ARPoint point, ARHitTestResultType resultType) { List <ARHitTestResult> hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest(point, resultType); if (hitResults.Count > 0) { foreach (var hitResult in hitResults) { Debug.Log("Got Hit!"); var position = UnityARMatrixOps.GetPosition(hitResult.worldTransform); var rotation = UnityARMatrixOps.GetRotation(hitResult.worldTransform); switch (objectMode) { case ObjectMode.INV: if (m_ARKitProjectUI.GetGameObjectPressed() == null) { GameObject invisibleWall = (GameObject)Instantiate(invisibleWall_prefab); m_invisibleWallPlacement = invisibleWall.GetComponent <ObjectPlacement>(); m_invisibleWallPlacement.placeObject(position, rotation); } break; case ObjectMode.DEL: GameObject gameObjectDel = m_ARKitProjectUI.GetGameObjectPressed(); if (gameObjectDel != null) { Destroy(gameObjectDel); } break; case ObjectMode.OB1: if (object1_duplicate == true) { if (m_ARKitProjectUI.GetGameObjectPressed() == null) { GameObject object1 = (GameObject)Instantiate(object1_prefab); m_object1Placement = object1.GetComponent <ObjectPlacement>(); m_object1Placement.placeObject(position, rotation); } } else { GameObject object1 = GameObject.FindWithTag("object1"); if (object1 == null) { object1 = (GameObject)Instantiate(object1_prefab); object1.tag = "object1"; m_object1Placement = object1.GetComponent <ObjectPlacement>(); m_object1Placement.placeObject(position, rotation); } else { m_object1Placement = object1.GetComponent <ObjectPlacement>(); m_object1Placement.placeObject(position, rotation); } } break; case ObjectMode.OB2: if (object2_duplicate == true) { if (m_ARKitProjectUI.GetGameObjectPressed() == null) { GameObject object2 = (GameObject)Instantiate(object2_prefab); m_object2Placement = object2.GetComponent <ObjectPlacement>(); m_object2Placement.placeObject(position, rotation); } } else { GameObject object2 = GameObject.FindWithTag("object2"); if (object2 == null) { object2 = (GameObject)Instantiate(object2_prefab); object2.tag = "object2"; m_object2Placement = object2.GetComponent <ObjectPlacement>(); m_object2Placement.placeObject(position, rotation); } else { m_object2Placement = object2.GetComponent <ObjectPlacement>(); m_object2Placement.placeObject(position, rotation); } } break; } return(true); } } return(false); }
bool HitTestWithResultType(ARPoint point, ARHitTestResultType resultType) { List <ARHitTestResult> hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest(point, resultType); if (hitResults.Count > 0) { foreach (var hitResult in hitResults) { Debug.Log("Got Hit!"); //This was used in the original UnityARHitTestExample, //but we want to have multiple objects placed based on toggles // so we will change it //m_HitTransform.position = UnityARMatrixOps.GetPosition(hitResult.worldTransform); //m_HitTransform.rotation = UnityARMatrixOps.GetRotation(hitResult.worldTransform); //Debug.Log(string.Format("x:{0:0.######} y:{1:0.######} z:{2:0.######", m_HitTransform.position.x, m_HitTransform.position.y, m_HitTransform.position.z)); var position = UnityARMatrixOps.GetPosition(hitResult.worldTransform); var rotation = UnityARMatrixOps.GetRotation(hitResult.worldTransform); switch (objectMode) { case ObjectMode.INV: if (m_ARKitProjectUI.GetGameObjectPressed() == null) { GameObject invisibleWall = (GameObject)Instantiate(invisibleWall_prefab); m_invisibleWallPlacement = invisibleWall.GetComponent <ObjectPlacement>(); m_invisibleWallPlacement.placeObject(position, rotation); } break; case ObjectMode.DEL: GameObject gameObjectDel = m_ARKitProjectUI.GetGameObjectPressed(); if (gameObjectDel != null) { Destroy(gameObjectDel); } break; case ObjectMode.OB1: if (object1_duplicate == true) { if (m_ARKitProjectUI.GetGameObjectPressed() == null) { GameObject object1 = (GameObject)Instantiate(object1_prefab); m_object1Placement = object1.GetComponent <ObjectPlacement>(); m_object1Placement.placeObject(position, rotation); } } else { GameObject object1 = GameObject.FindWithTag("object1"); if (object1 == null) { object1 = (GameObject)Instantiate(object1_prefab); object1.tag = "object1"; m_object1Placement = object1.GetComponent <ObjectPlacement>(); m_object1Placement.placeObject(position, rotation); } else { m_object1Placement = object1.GetComponent <ObjectPlacement>(); m_object1Placement.placeObject(position, rotation); } } break; case ObjectMode.OB2: if (object2_duplicate == true) { if (m_ARKitProjectUI.GetGameObjectPressed() == null) { GameObject object2 = (GameObject)Instantiate(object2_prefab); m_object2Placement = object2.GetComponent <ObjectPlacement>(); m_object2Placement.placeObject(position, rotation); } } else { GameObject object2 = GameObject.FindWithTag("object2"); if (object2 == null) { object2 = (GameObject)Instantiate(object2_prefab); object2.tag = "object2"; m_object2Placement = object2.GetComponent <ObjectPlacement>(); m_object2Placement.placeObject(position, rotation); } else { m_object2Placement = object2.GetComponent <ObjectPlacement>(); m_object2Placement.placeObject(position, rotation); } } break; } return(true); } } return(false); }