示例#1
0
    public void DragEnd()
    {
        dragEnd = Input.mousePosition;
        endTime = Time.time;

        float dragDuration  = endTime - startTime;
        float launchSpeed_x = (dragEnd.x - dragStart.x) / dragDuration;
        float launchSpeed_z = (dragEnd.y - dragStart.y) / dragDuration;

        launchSpeed_z *= -1;

        Vector3 launchVelocity = new Vector3(launchSpeed_x, 0, launchSpeed_z);

        ball.Launch(launchVelocity);
    }