Include the following details (edit as applicable):
- Issue category: Lightship Maps / Semantic Segmentation / Multiplayer / Real-time Mapping-Depth / ARDK Documentation / Unity Example Package / Sample App aka ‘AR Voyage’ / ARDK Virtual Studio Tools / Developer Tools / Networking / VPS / Scanning Framework
- Device type & OS version: Android / iOS / Other Ex. iPhone 8+ on iOS 13
- Host machine & OS version: Windows /
- Issue Environment : Unity Mock / On Device
- ARDK version:
- Unity version:2021.3.15f1
Description of the issue:
Ray ray = Camera.main.ScreenPointToRay(touch.position);
RaycastHit hit;
if (Physics.Raycast(ray, out hit))
{
if (hit.collider.tag == "apple")
{
dragObject = hit.transform;
distanceToCamera = dragObject.position.z - Camera.main.transform.position.z;
relativePositionTouch = new Vector3(_touchPosition.x, _touchPosition.y, distanceToCamera);
relativePositionTouch = Camera.main.ScreenToWorldPoint(relativePositionTouch);
cameraToObjectOffset = dragObject.position - relativePositionTouch;
isHeld = true;
Debug.Log($"Esta es la fase del touch: {touch.phase}");
}
}
}
private void MovedObjet(Touch touch)
{
Vector2 _touchPosition = touch.position;
relativePositionTouch = new Vector3(_touchPosition.x, _touchPosition.y, distanceToCamera);
relativePositionTouch = Camera.main.ScreenToWorldPoint(relativePositionTouch);
dragObject.position = relativePositionTouch + cameraToObjectOffset;
}