public void RequestDragPickable(Component colliderComponent) { if (TouchWrapper.TouchCount == 1) { SelectColliderInternal(colliderComponent, false, false); isManualSelectionRequest = true; Vector3 fingerDownPos = TouchWrapper.Touch0.Position; Vector3 intersectionPoint; Ray dragRay = mobileTouchCam.Cam.ScreenPointToRay(fingerDownPos); bool hitSuccess = mobileTouchCam.RaycastGround(dragRay, out intersectionPoint); if (hitSuccess == false) { intersectionPoint = colliderComponent.transform.position; } if (requireLongTapForMove == true) { isSelectedViaLongTap = true; //This line ensures that dragging via scrip also works when 'requireLongTapForDrag' is set to true. } RequestDragPickable(colliderComponent, fingerDownPos, intersectionPoint); invokeMoveEndedOnDrag = true; } else { Debug.LogError("A drag request can only be invoked when the user has placed exactly 1 finger on the screen."); } }
public void RequestDragPickable(Component colliderComponent) { if (TouchWrapper.TouchCount == 1) { SelectColliderInternal(colliderComponent, false, false); isManualSelectionRequest = true; Vector3 fingerDownPos = TouchWrapper.Touch0.Position; Vector3 intersectionPoint; Ray dragRay = mobileTouchCam.Cam.ScreenPointToRay(fingerDownPos); bool hitSuccess = mobileTouchCam.RaycastGround(dragRay, out intersectionPoint); if (hitSuccess == false) { intersectionPoint = colliderComponent.transform.position; } RequestDragPickable(colliderComponent, fingerDownPos, intersectionPoint); invokeMoveEndedOnDrag = true; } else { Debug.LogError("A drag request can only be invoked when the user has placed exactly 1 finger on the screen."); } }