Failed to detect touch

following this script from the tutorial (line 26),
https://playcanvas.com/editor/code/629759?tabs=21687458,21687443

I tried to implement this code on a box

var PositionOnclick = pc.createScript('positionOnclick');


// initialize code called once per entity
PositionOnclick.prototype.initialize = function() {
    this._rotPos = new pc.Vec3(0,0.5,0);
    if(this.app.touch)
    {
        this.app.touch.on(pc.EVENT_TOUCHEND,this.ChooseThisElement,this);
        
        this.on('destroy', function() {
            this.app.touch.off(pc.EVENT_TOUCHEND,this.ChooseThisElement,this);
        });
    }

};

        
PositionOnclick.prototype.ChooseThisElement = function(event)
{
    console.log("hello");
};

where I later want to implement the functionality.
problem is, I don’t figure any mistake I’ve done but still, there is no log when I click on the box

Can you link to your project please?

the problem was that i used touch and then tried to mouse click
when i implemented

var SelectionMouseInput = pc.createScript('selectionMouseInput');

// initialize code called once per entity
SelectionMouseInput.prototype.initialize = function() {
    this.app.mouse.on(pc.EVENT_MOUSEUP, this.onMouseUp, this);
    this.on('destroy', function() {
        this.app.mouse.off(pc.EVENT_MOUSEUP, this.onMouseUp, this);
    });

};

SelectionMouseInput.prototype.onMouseUp = function (event) {

    console.log("hello)");
};


// update code called every frame
SelectionMouseInput.prototype.update = function(dt) {
    
};

it seems to work fine, but now the issue is that this way I still need to go from click into getting data and activating a function on the object I touched;
the box has a script with ‘myIndex’ attribute and a function SelectThis and hides this

Can you link to the Editor please? We can’t see any of the code/scene setup with a published build.

erm, i tried but…
how do i do that?

https://playcanvas.com/editor/scene/784107

like this?

Yes, like that.

Looks like you are trying to do a physics raycast in a scene that has no physics objects.

The way it was done with the hotspot project was to use the pc.Shapes and a intersection test with a ray per hotspot: https://developer.playcanvas.com/en/tutorials/information-hotspots/