// Update is called once per frame void Update() { if (pm.trackables.count > 0 && !firstPlane) { foreach (var plane in pm.trackables) { if (!firstPlane) { myPlane = plane;//Get the first plane Generated firstPlane = true; } } planeDetectGUI.text = "Plane Detected!";//Updates GUI planeDetectGUI.color = Color.green; myCube = Instantiate(cubePrefab, new Vector3(0f, cubePrefab.transform.localScale.y, 0f), Quaternion.identity); aud.Play(); sessionOrigin.MakeContentAppearAt(myCube.transform, myPlane.center, Quaternion.identity);//Places cube at centre of the found plane myPlane.boundaryChanged += UpdateCube;//Repositions the cube whenever the plane is resized } }
void Update() { // Consider putting this in its own function if (Input.touchCount > 0) { touch = Input.GetTouch(0); if (Input.GetTouch(0).phase == TouchPhase.Began) { // Add a faded black background // Add a white boarder to the chosen object Vector3 pos = arCamera.ScreenToWorldPoint(new Vector3(touch.position.x, touch.position.y, 1f)); placedObject = Instantiate(objectPrefab); arSessionOrigin.MakeContentAppearAt(placedObject.transform, pos, Quaternion.identity); } else if (Input.GetTouch(0).phase == TouchPhase.Moved) { // Create a move delta to check against // Only move the object if the move delta is big enough // In Weird Cuts TouchPhase.Moved is used to rotate and scale the object // Left and Right swipes = Rotation // Up and Down swipes = Increase/Decrease scale Vector3 pos = arCamera.ScreenToWorldPoint(new Vector3(touch.position.x, touch.position.y, 1f)); arSessionOrigin.MakeContentAppearAt(placedObject.transform, pos, Quaternion.identity); } else if (Input.GetTouch(0).phase == TouchPhase.Ended) { // If a black background was added turn it off here // If a white boundary was added to the object turn it off here } } }
void Update() { if (!_objectSet) { if (_readyToPlace) { UpdatePlacementPose(); // Check if there is a touch if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began) { // Check if finger is over a UI element e.g. one of the Sliders. If not, then user // has touched the screen to place the object // If they are over a menu UI item, then ignore the touch if (!EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId)) { PlaceObject(); _objectSet = true; placementIndicator.SetActive(false); GameManager.Instance.SetLogText(""); } } } } else { //IMPORTANT - Perform code below ONLY if TouchCount is 1, as if it's 2, then we're Scaling and/or Rotating //which is handled in the ARScaleAndRotate script if (Input.touchCount == 1) { var touch = Input.GetTouch(0); // Check if user is touching screen and is NOT over a UI element (Scale or Rotate).. This means they are // trying to move an object if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved) { if (!EventSystem.current.IsPointerOverGameObject(touch.fingerId)) { #if UNITY_IOS if (_raycastManager.Raycast(touch.position, s_Hits, TrackableType.PlaneWithinPolygon)) // if (_raycastManager.Raycast(touch.position, s_Hits, TrackableType.PlaneWithinPolygon | TrackableType.FeaturePoint)) #else if (_raycastManager.Raycast(touch.position, s_Hits, TrackableType.Planes)) #endif { // Raycast hits are sorted by distance, so the first one // will be the closest hit. var hitPose = s_Hits[0].pose; // This does not move the content; instead, it moves and orients the ARSessionOrigin // such that the content appears to be at the raycast hit position. m_SessionOrigin.MakeContentAppearAt(GOTransform(), hitPose.position); } } } } } }
// Update is called once per frame void Update() { //Debug.Log("VR " + VRPlayerPrefab.transform.position); if (!boardIsPlaced) { if (RaycastManager.Raycast(centerScreenPos, listHits, TrackableType.PlaneWithinPolygon)) { // Raycast hits are sorted by distance, so the first one // will be the closest hit. hitPose = listHits[0].pose; if (spawnedObject == null) { spawnedObject = Instantiate(board); SessionOrigin.MakeContentAppearAt(spawnedObject.transform, hitPose.position, hitPose.rotation); } else { SessionOrigin.MakeContentAppearAt(spawnedObject.transform, hitPose.position); } } } if (boardIsPlaced && !positionVRPlayerIsSet) { if (!TryGetTouchPosition(out Vector2 touchPosition)) { return; } else { Ray ray = Camera.main.ScreenPointToRay(touchPosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { //Debug.Log("Ray hit " + hit.collider.name); if (hit.collider.CompareTag("Floor")) { if (vrCharacter == null) { vrCharacter = Instantiate(VRPlayerPrefab); } else { vrCharacter.transform.position = new Vector3(hit.point.x, 1, hit.point.z); //Debug.Log("Plane " + spawnedObject.transform.position); //Debug.Log("VRPlayerPrefab " + vrCharacter.transform.position); } } } } } }
private void PlaceObject() { placementIndicator.SetActive(false); elevator.SetActive(true); Vector3 rot = rotate.localEulerAngles; rot = new Vector3(0, 180 + rot.y, 0); print(Camera.current.transform.localRotation); arOrigin.MakeContentAppearAt(objectToPlace.transform, placementPose.position); arOrigin.MakeContentAppearAt(objectToPlace.transform, Quaternion.Euler(rot)); placed = true; buttonBack.SetActive(true); buttonContinue.SetActive(true); }
// Update is called once per frame void Update() { //We create a new Translation and Rotation from the transform of the GameObject //The GameObject Translation and Rotation is updated by the pose driver var arTranslation = new Translation { Value = transform.position }; var arRotation = new Rotation { Value = transform.rotation }; //Now we update our ARPoseComponent with the updated Pose Driver data var arPose = new ARPoseComponent { translation = arTranslation, rotation = arRotation }; m_ClientSimGroup.SetSingleton <ARPoseComponent>(arPose); //If the player was spawned, we will move the AR camera to behind the spawn location if (!m_SpawnPositionQuery.IsEmptyIgnoreFilter) { //We grab the component from the Singleton var spawnPosition = m_ClientSimGroup.GetSingleton <SpawnPositionForARComponent>(); // Debug.Log("spawn position is: " + spawnPosition.spawnTranslation.ToString()); //We set the new pose to behind the player (0, 2, -10) (this is the same value the player is put in front of the pose in InputResponseMovementSystem) var newPoseTranslation = (spawnPosition.spawnTranslation) + (math.mul(spawnPosition.spawnRotation, new float3(0, 2, 0)).xyz) - (math.mul(spawnPosition.spawnRotation, new float3(0, 0, 10)).xyz); //The rotation will be the same var newPoseRotation = (spawnPosition.spawnRotation); // Debug.Log("calculated camera position is: " + newPoseTranslation.ToString()); //MakeContentAppearAt requires a transform even though it is never used so we create a dummy transform Transform dummyTransform = new GameObject().transform; //First we will undo our last MakeContentAppearAt to go back to "normal" m_ARSessionOrigin.MakeContentAppearAt(dummyTransform, -1f * m_LastTranslation, Quaternion.Inverse(m_LastRotation)); //Now we will update our LastTranslation and LastRotations to the values we are about to use //Because of how MakeContentAppearAt works we must do the inverse to move our camera where we want it m_LastTranslation = -1f * newPoseTranslation; m_LastRotation = Quaternion.Inverse(newPoseRotation); //Now that we have set the variables we will use them to adjust the AR pose m_ARSessionOrigin.MakeContentAppearAt(dummyTransform, m_LastTranslation, m_LastRotation); // Debug.Log("transform after MakeContentAppearAt: " + transform.position.ToString()); //Now we delete the entity so this only runs during an initial spawn m_ClientWorld.EntityManager.DestroyEntity(m_ClientSimGroup.GetSingletonEntity <SpawnPositionForARComponent>()); } }
// Update is called once per frame void Update() { if (!TryGetTouchPosition(out Vector2 touchposition)) { return; } if (_aRRaycastManager.Raycast(touchposition, hits, trackableTypes: TrackableType.PlaneWithinPolygon)) { var hitpose = hits[0].pose; if (Isspawned == 0) { Isspawned = 1; spawnedObject = (GameObject)Instantiate(gameObjectToInstantiate, new Vector3(hitpose.position.x, hitpose.position.y + 1, hitpose.position.z), m_Rotation, GameObject.Find("Offset").transform); SessionOrigin.MakeContentAppearAt(content, hitpose.position, m_Rotation); GameObject.Find("GameHandler").GetComponent <WaveSpawner>().Start(); } //spawnedObject = Instantiate(gameObjectToInstantiate, hitpose.position, hitpose.rotation); //SessionOrigin.MakeContentAppearAt(content, hitpose.position, rotation); //spawnedObject = 1; /*else * { * spawnedObject.transform.position = hitpose.position; * spawnedObject.transform.rotation = hitpose.rotation; * }*/ } }
private void Update() { if (!_MoveWithScreen) { return; } if (!_FirstPlaneFound) { return; } if (Input.touchCount > 0) { _MoveWithScreen = false; Destroy(_previewObject); //stop tracking new planes _ARPlaneManager.SetTrackablesActive(false); _ARPlaneManager.enabled = false; PlaceSelected?.Invoke(_lastHitPosePosition); return; } if (_ARRaycastManager.Raycast(_screenCenter, _hits, UnityEngine.XR.ARSubsystems.TrackableType.PlaneWithinPolygon)) { var hitPose = _hits[0].pose; _lastHitPosePosition = hitPose.position; _ARSessionOrigin.MakeContentAppearAt(_previewObject.transform, hitPose.position); } }
private void updatePlacement() { // Send raycast from center of screen Debug.Log("Updating placement!"); var screenCenter = Camera.main.ViewportToScreenPoint(new Vector3(0.5f, 0.5f)); var hits = new List <ARRaycastHit>(); // Send Raycast and check if it hit any trackable placementPoseIsValid = arOrigin.Raycast(screenCenter, hits, TrackableType.Planes); if (placementPoseIsValid) { Debug.Log("Placement is VALID!"); // Use its pose to update the object's pose placementPose = hits[0].pose; // Update pose to move with the camera's angle view var cameraForward = Camera.main.transform.forward; var cameraBearing = new Vector3(cameraForward.x, 0, cameraForward.z).normalized; placementPose.rotation = Quaternion.LookRotation(cameraBearing); // update placement arOrigin.MakeContentAppearAt(trackingObj.transform, placementPose.position); // arOrigin.MakeContentAppearAt(trackingObj.transform, placementPose.position, placementPose.rotation); trackingObj.SetActive(true); Debug.Log("Object is now active!"); } else { trackingObj.SetActive(false); Debug.Log("Placement is INVALID!: Object is now inactive."); } }
private void InstantiateObjectOnDetectedPlane() { if (Input.touchCount > 1) { Touch touch_1 = Input.GetTouch(0); //Touch touch_2 = Input.GetTouch(1); //if (touch_1.position == touch_2.position) //{ if (touch_1.phase == TouchPhase.Began && _raycastManager.Raycast(touch_1.position, _hits, TrackableType.PlaneWithinPolygon) && isObjectInstantiated == false) { Pose pose = _hits[0].pose; var obj = Instantiate(go, pose.position, pose.rotation); _sessionOrigin.MakeContentAppearAt(obj.transform, obj.transform.position, obj.transform.rotation); isObjectInstantiated = true; SetAllPlanesActive(false); StartCoroutine(AfterInstantiation(obj)); } //} } }
private void OnEnable() { _spawnRoutine = StartCoroutine(SpawnRoutine()); _origin.MakeContentAppearAt(_arRoot, Vector3.zero); Screen.sleepTimeout = SleepTimeout.NeverSleep; }
void Update() { if (!TryGetTouchPosition(out Vector2 touchPosition)) { return; } bool isOverUI = touchPosition.IsPointerOverUIObject(); if (!isOverUI && m_RaycastManager.Raycast(touchPosition, s_Hits, TrackableType.PlaneWithinPolygon)) { // Raycast hits are sorted by distance, so the first one // will be the closest hit. var hitPose = s_Hits[0].pose; if (spawnedObject == null) { //spawning AR prefab cubes spawnedObject = Instantiate(m_BrickPlacementManager.m_PlacedPrefab, hitPose.position, hitPose.rotation); m_SessionOrigin.MakeContentAppearAt(spawnedObject.transform, spawnedObject.transform.position, spawnedObject.transform.rotation); //Adding to List prefabInfos m_BrickPlacementManager.AddPrefabListHandler(m_BrickPlacementManager.newPrefabInfos, m_PlacedPrefab, hitPose.position, hitPose.rotation); } else { spawnedObject = null; this.gameObject.GetComponent <BrickPlacementManager>().enabled = true; this.enabled = false; //spawnedObject.transform.position = hitPose.position; } } }
private void placeObjectAtMarker() { SessionOrigin.MakeContentAppearAt(ObjectToPlace.transform, Marker.transform.position + new Vector3(0, distanceBetweenCameraAndMarker() * 0.75f, 0), Marker.transform.rotation); ObjectToPlace.SetActive(true); Marker.SetActive(false); IsObjectPlaced = true; uIManager.ShowIngameCanvas(); }
void Update() { //if we touched the screen, and that results in a tap on a detected plane, place content where we tapped if (Input.GetMouseButton(0) && !EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId) && arSessionOrigin.Raycast(Input.mousePosition, RaycastHits, TrackableType.PlaneWithinBounds)) { arSessionOrigin.MakeContentAppearAt(placementTransform, RaycastHits[0].pose.position); } }
// Update is called once per frame void Update() { // Try to get touch on screen if (!TryGetTouch(out Touch touch)) { return; } // extract position from touch touchPosition = touch.position; // Intersect found plane with raycast if (!IsPointerOverUIObject() && arRayCastManager.Raycast(touchPosition, hits, TrackableType.PlaneWithinInfinity)) { Pose hitPose = hits[0].pose; if (!spawnedObject) { // Spawn game object spawnedObject = Instantiate(prefabToPlace, hitPose.position, hitPose.rotation); arSessionOrigin.MakeContentAppearAt(spawnedObject.transform, hitPose.position, hitPose.rotation); targetRotation = spawnedObject.transform.rotation; targetScale = arSessionOrigin.transform.localScale; scriptableManager.ControlState.IsSpawned = true; onPlacedObject(); } else if (scriptableManager.ControlState.IsRelocating) { if (touch.phase == TouchPhase.Moved) { // relocate object if IsRelocating enabled arSessionOrigin.MakeContentAppearAt(spawnedObject.transform, hitPose.position, hitPose.rotation); } } } if (spawnedObject) { // Set target rotation and scale calculated in LateUpdate() arSessionOrigin.MakeContentAppearAt(spawnedObject.transform, spawnedObject.transform.position, targetRotation); arSessionOrigin.transform.localScale = targetScale; } }
// Start is called before the first frame update void Start() { arOrigin = FindObjectOfType <ARSessionOrigin>(); isValidPose = false; gameMode = false; wayText.SetActive(true); cubeText.SetActive(false); StartCoroutine(TextTime()); arOrigin.MakeContentAppearAt(contentAppear.transform, Quaternion.identity); }
void Update() { if (Input.touchCount == 0) { return; } Touch touch = Input.GetTouch(0); if (Input.touchCount > 0 && EventSystem.current.IsPointerOverGameObject(touch.fingerId)) // UI위에서는 터치가 안되게 하기 { return; } if (touch.phase == TouchPhase.Began) { ray = arCamera.ScreenPointToRay(touch.position); if (Physics.Raycast(ray, out cameraHit, 100.0f)) { if (cameraHit.collider.CompareTag("SPACE")) { ischeckUI = !ischeckUI; //UIObject.SetActive(ischeckUI); Debug.Log(ischeckUI); } } if (ratcastMgr.Raycast(touch.position, hits, TrackableType.PlaneWithinPolygon)) { if (hits[0].trackableId != trackidNow) // 현재 터치한 구간이 새로생긴 경우 { trackidNow = hits[0].trackableId; // 현재 트랙 아이디 저장 foreach (TrackableId ischeckId in spwanedObjs.Keys) // 기존 아이디에 저장될 경우 리턴(한면당 한공간만 생성) { if (ischeckId == trackidNow) { return; } } tempGameObject = Instantiate(placeObject, hits[0].pose.position, hits[0].pose.rotation); Debug.Log("찍은 좌표" + tempGameObject.transform.position); spwanedObjs.Add(trackidNow, tempGameObject); // 터치 아이디 및 오브젝트 추가 //Debug.Log("현재아이디 : " + trackidNow); } else if (hits[0].trackableId == trackidNow) // 현재 터치 구간일 경우 이동 가능 { Debug.Log("찍은 좌표" + hits[0].pose.position); //tempGameObject.transform.Translate(hits[0].pose.position); arSessionOrigin.MakeContentAppearAt(tempGameObject.transform, hits[0].pose.position, tempGameObject.transform.rotation); } } } }
//Load function public void LoadWallHandler() { PrefabCollection loadedPrefabInfos = JsonUtility.FromJson <PrefabCollection>(JsonFileUtility.LoadJsonFromFile("SaveBrickWall.json", false)); foreach (PrefabInfo prefab in loadedPrefabInfos.prefabInfos) { GameObject loadCube = Instantiate(blockPrefabs[prefab.prefabNum], new Vector3(prefab.posX, prefab.posY, prefab.posZ), new Quaternion(prefab.rotX, prefab.rotY, prefab.rotZ, 0)); m_SessionOrigin.MakeContentAppearAt(loadCube.transform, loadCube.transform.position, loadCube.transform.rotation); loadCube.GetComponentInChildren <MeshRenderer>().material = mats[prefab.matNum]; } SoundManager.instance.playSFXByID(1); }
// Use this for initialization void Start() { buttonBack.SetActive(false); buttonContinue.SetActive(false); startPosition = objectToPlace.transform.position; startRotation = objectToPlace.transform.rotation; arOrigin = FindObjectOfType <ARSessionOrigin>(); city.SetActive(false); elevator.SetActive(false); objectToPlace.SetActive(true); arOrigin.MakeContentAppearAt(objectToPlace.transform, startPosition, startRotation); }
private void instantiatePrefab(PointerEventData eventData) { if (m_SessionOrigin.Raycast(Input.GetTouch(0).position, s_Hits, TrackableType.Planes)) { var hit = s_Hits[0]; spawnedObject = Instantiate(m_PlacedPrefab); // Position at one meter above the ground. var offset = startingScale * Vector3.up; m_SessionOrigin.MakeContentAppearAt(spawnedObject.transform, hit.pose.position + offset, hit.pose.rotation); SetAllPlanesActive(false); } }
public void PlaceOnSelectedPlane(Transform contentParent, float contentDimension) { ARSessionOrigin.MakeContentAppearAt(contentParent, tappedPosition, tappedRotation); ARSessionOrigin.transform.localScale = Vector3.one * (contentDimension / tappedMinDimension); arCamera.nearClipPlane = savedCameraNear * (contentDimension / tappedMinDimension); arCamera.farClipPlane = savedCameraFar * (contentDimension / tappedMinDimension); ARPlaneManager arPlaneManager = ARSessionOrigin.GetComponent <ARPlaneManager>(); arPlaneManager.planePrefab = null; //do not generate any more visible planes ARSessionOrigin.trackablesParent.gameObject.SetActive(false); //turn off existing visible planes }
private void PlaceObject() { if (current != null) { return; } placementIndicator.SetActive(false); current = Instantiate(objectToPlace, placementPose.position, placementPose.rotation); arOrigin.MakeContentAppearAt(current.transform, current.transform.position, current.transform.rotation); }
public void SetScale(float _scaleValue) { _newScale.x = _scaleValue; _newScale.y = _scaleValue; _newScale.z = _scaleValue; _sessionOrigin.transform.localScale = _newScale; if (myARTTPO.theGO != null) { _sessionOrigin.MakeContentAppearAt(myARTTPO.theGO.transform, myARTTPO.theContentLocationPose.position); } }
IEnumerator Up() { RenderSettings.skybox = skyBox; arBackground.useCustomMaterial = true; city.SetActive(true); rend.material = window; Vector3 location = new Vector3(city.transform.position.x, city.transform.position.y - 0.08f, city.transform.position.z); Vector3 locationEle = new Vector3(elevator.transform.position.x, elevator.transform.position.y + 0.08f, elevator.transform.position.z); arOrigin.MakeContentAppearAt(city.transform, location); elevator.transform.position = locationEle; yield return(new WaitForSeconds(0.001f)); }
// Update is called once per frame void Update() { if (!boardIsPlaced) { if (RaycastManager.Raycast(centerScreenPos, listHits, TrackableType.PlaneWithinPolygon)) { // Raycast hits are sorted by distance, so the first one // will be the closest hit. hitPose = listHits[0].pose; if (spawnedObject == null) { spawnedObject = Instantiate(board); SessionOrigin.MakeContentAppearAt(spawnedObject.transform, hitPose.position, hitPose.rotation); } else { SessionOrigin.MakeContentAppearAt(spawnedObject.transform, hitPose.position); } } } }
private void UpdatePlacementIndicator() { if (placementPoseIsValid) { placementObject.SetActive(true); arOrigin.MakeContentAppearAt(placementObject.transform, placementPose.position, placementPose.rotation); } else { placementObject.SetActive(false); } }
public void ApplyScale(float value) { if (!sessionOrigin || !spawnedObject) { Debug.LogError($"Connect components to the Scaler"); return; } Vector3 newTargetScale = new Vector3(value, value, value); sessionOrigin.MakeContentAppearAt(spawnedObject, spawnedObject.position, spawnedObject.rotation); LeanTween.scale(sessionOrigin.gameObject, newTargetScale, 0.13f).setEase(LeanTweenType.easeOutBack); }
void Update() { planeManager.enabled = !planeManager.enabled; if (Input.touchCount > 0) { Touch touch = Input.GetTouch(0); if (touch.phase == TouchPhase.Began && raycastManager.Raycast(touch.position, hits, TrackableType.PlaneWithinPolygon) && isInstantiated == false) { Pose pose = hits[0].pose; GameObject btnPrefab = null; if (currValue == ButtonValue.Rain) { btnPrefab = RainPrefab; } else if (currValue == ButtonValue.Blizzard) { btnPrefab = BlizzardPrefab; } else if (currValue == ButtonValue.Fire) { btnPrefab = FirePrefab; } else if (currValue == ButtonValue.Tornado) { btnPrefab = TornadoPrefab; } else if (currValue == ButtonValue.Meteor) { btnPrefab = MeteorPrefab; } else if (currValue == ButtonValue.Tsunami) { btnPrefab = TsunamiPrefab; } else if (currValue == ButtonValue.Plague) { btnPrefab = PlaguePrefab; } var go = Instantiate(btnPrefab, pose.position, pose.rotation); sessionOrigin.MakeContentAppearAt(go.transform, go.transform.position, go.transform.rotation); isInstantiated = true; audioSource.volume = 0.1f; SetAllPlanesActive(false); StartCoroutine(OnDestroyPrefab(go)); } } }
// Each time a marker is detected, perform some actions void OnTrackedImagesChanged(ARTrackedImagesChangedEventArgs eventArgs) { foreach (var updatedImage in eventArgs.updated) { // Translate AR session origin to world gameobject absolute position + rotation if (updatedImage.referenceImage.name == "calibration marker") { m_SessionOrigin.MakeContentAppearAt(world.transform, updatedImage.transform.position, updatedImage.transform.localRotation); } // Detect left root and right foot marker, setting respective prefabs' position and rotation if (updatedImage.referenceImage.name == "left foot marker") { if (leftFoot == null) { leftFoot = PhotonNetwork.Instantiate(footPrefab.name, new Vector3(0, 0, 0), Quaternion.identity); Debug.LogFormat("Added foot prefab for left foot"); } leftFoot.transform.position = updatedImage.transform.position; leftFoot.transform.rotation = updatedImage.transform.rotation; } if (updatedImage.referenceImage.name == "right foot marker") { if (rightFoot == null) { rightFoot = PhotonNetwork.Instantiate(footPrefab.name, new Vector3(0, 0, 0), Quaternion.identity); Debug.LogFormat("Added foot prefab for right foot"); } rightFoot.transform.position = updatedImage.transform.position; rightFoot.transform.rotation = updatedImage.transform.rotation; } } // Remove foot if images are removed foreach (var removedImage in eventArgs.removed) { if (removedImage.referenceImage.name == "left foot marker") { Debug.LogFormat("Removing left foot image"); Destroy(leftFoot); leftFoot = null; } if (removedImage.referenceImage.name == "right foot marker") { Debug.LogFormat("Removing right foot image"); Destroy(rightFoot); rightFoot = null; } } }
void Update() { if (Input.touchCount == 0) { return; } Touch touch = Input.GetTouch(0); if (raycastManager.Raycast(touch.position, hits, TrackableType.All)) { Pose hitPose = hits[0].pose; arSessionOrigin.MakeContentAppearAt(target, hitPose.position, hitPose.rotation); } }