Failed to detect touch

following this script from the tutorial (line 26),,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);
        this.on('destroy', function() {


PositionOnclick.prototype.ChooseThisElement = function(event)

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.onMouseUp, this);
    this.on('destroy', function() {, this.onMouseUp, this);


SelectionMouseInput.prototype.onMouseUp = function (event) {


// 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?

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: