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.onMouseDown, this);, this.onMouseUp, this);, this.onMouseMove, this);
    if ( {, this.onTouchStart, this);, this.onTouchEnd, this);, this.onTouchMove, this);
     this.on('destroy', function() {
    , this.onMouseDown, this);, this.onMouseUp, this);
, this.onMouseMove, this);

        if ( {
  , this.onTouchStart, this);
  , this.onTouchEnd, this);
  , this.onTouchMove, this);
    }, this);

BallMovement1.prototype.update = function(dt) {


BallMovement1.prototype.onMouseMove = function(event) {

      var depth = 950;
    var cameraEntity ='Camera');, event.y/100, depth, this.pos);
    this.pos.set(event.x, event.y,depth);

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.