public void AddObject(InputAction.CallbackContext context) { var touchPosition = context.ReadValue <Vector2>(); if (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) { //spawnedObject = Instantiate(m_PlacedPrefab, hitPose.position, hitPose.rotation); spawnedObject = Instantiate(arManager.GetARModel(), hitPose.position, hitPose.rotation); spawnedObject.transform.rotation = snapObject.rotation; arManager.invokeOnScreenModel(spawnedObject); } else if (isDragOn) { spawnedObject.transform.position = hitPose.position; } } }