[SOLVED] Entity clicking by frame buffer - no longer working?

The PC tutorials include a method for entity clicking using the frame buffer.
I used this in one of my applications and it seems as it is no longer working.
I assume this could be due to some pc update, as the tutorial doesn’t seem to work either:

See:
https://launch.playcanvas.com/440138?debug=true
(testing on my PC only the middle cube registers clicks)

vs


(old build, here all objects register the click and call the pulse)

As always, thanks for any info on this.

1 Like

Hi @Rechi,

Tested the example on Chrome/Win10, it’s seems to work on my side but with reduced accuracy. For example I have to click close to the sphere/cone center to get them picked, in the old build of the example that isn’t the case.

The box is being picked as expected, clicking on any pixel does that job.

@mvaligursky @yaustar any idea?

Looks like it was introduced in 1.41.0. Investigating

1 Like

I refactored that code considerably recently … but this and also editor works, which I used for testing
http://playcanvas.github.io/#graphics/area-picker.html

I might need to investigate.

It’s probably related to aspect ratio of the texture in some way … when I make the viewport square, it seems to work.

Fixed. picker.resize needs to be called before prepare.

3 Likes

lovely, thanks @yaustar

That’s amazing. Great work as always. Thank you very much!

1 Like

@Rechi I’ve just updated the project to use a ‘scale’ for the picker so you balance accuracy and performance

Edit: tutorial in PR: https://github.com/playcanvas/developer.playcanvas.com/pull/269

1 Like

On a roll now, Martin added support to pick from specific layers in 1.41.0 so added that to the tutorial now! :raised_hands:

4 Likes

Ah, that’s quite useful!