Throwing the ball with mousemove

Hello guys,

I hope that you have wonderfull day, but i need help with coding. If you have some little time to help me, i I will appreciate it.
I want to code simple basket ball and i want to throw it when i put my mouse or finger on screen, moving it to hoop on some direction, and than leave it. Than the ball should applyimpulse on this direction, where you move your finger or mouse. I hope, that you can understand me. I know, that there must be function screenToWorld and so on, but i dont know how exactly do that.

This is my code:

BallMovement1.prototype.initialize = function() {
     this.pos = new pc.Vec3();
    
    
    
    this.app.mouse.on(pc.EVENT_MOUSEDOWN, this.onMouseDown, this);
    this.app.mouse.on(pc.EVENT_MOUSEUP, this.onMouseUp, this);
    this.app.mouse.on(pc.EVENT_MOUSEMOVE, this.onMouseMove, this);
     
    if (this.app.touch) {
        this.app.touch.on(pc.EVENT_TOUCHSTART, this.onTouchStart, this);
        this.app.touch.on(pc.EVENT_TOUCHEND, this.onTouchEnd, this);
        this.app.touch.on(pc.EVENT_TOUCHMOVE, this.onTouchMove, this);
         }
    
     this.on('destroy', function() {
     
        this.app.mouse.off(pc.EVENT_MOUSEDOWN, this.onMouseDown, this);
         this.app.mouse.off(pc.EVENT_MOUSEUP, this.onMouseUp, this);
          this.app.mouse.off(pc.EVENT_MOUSEMOVE, this.onMouseMove, this);

        if (this.app.touch) {
            this.app.touch.off(pc.EVENT_TOUCHSTART, this.onTouchStart, this);
            this.app.touch.off(pc.EVENT_TOUCHEND, this.onTouchEnd, this);
            this.app.touch.off(pc.EVENT_TOUCHMOVE, this.onTouchMove, this);
        }     
    }, this);
};

BallMovement1.prototype.update = function(dt) {

};


BallMovement1.prototype.onMouseMove = function(event) {

      var depth = 950;
    var cameraEntity = this.app.root.findByName('Camera');
    cameraEntity.camera.screenToWorld(event.x/100, event.y/100, depth, this.pos);
    
    this.pos.set(event.x, event.y,depth);
    console.log(this.pos);
        
};

BallMovement1.prototype.onMouseDown = function(event) {
    
    if (event.button == pc.MOUSEBUTTON_LEFT) {
   
        
    }
    
    
};

BallMovement1.prototype.onMouseUp = function(event)  {
    
    if (event.button == pc.MOUSEBUTTON_LEFT) {
        
   
            this.entity.rigidbody.applyImpulse(this.pos.x/50, 4, -2);
        }
        
        
    };

If you know how do that, please help.
Thanks.