private void Update() { if (!_currentCarClicked && !_isMovingCar) { return; } RaycastHit hit; Ray ray = mainCam.ScreenPointToRay(_lastSwipeInput.EndPosition); if (!Physics.Raycast(ray, out hit, 500f)) { return; } Vector3 point = hit.point; point.y = 0; _currentCarClicked.SetTargetPosition(point + touchOffset); }
private void GestureControllerOnPressed(SwipeInput obj) { _lastSwipeInput = obj; Ray ray = mainCam.ScreenPointToRay(obj.EndPosition); if (!Physics.Raycast(ray, out RaycastHit hit, 500f)) { return; } if (hit.collider.GetComponent <Car.Car>()) { _isMovingCar = true; Car.Car hitCar = hit.collider.GetComponent <Car.Car>(); _currentCarClicked = hitCar; Vector3 point = hit.point; point.y = 0; _currentCarClicked.SetTargetPosition(point + touchOffset); _currentCarClicked.SetCarMoving(true); } }