Question :

How to click on a 3d object to then trigger a function

Solution :

You can use the script EventsControls.js (from Vildanov Almaz). This can be found here :

https://github.com/mrdoob/three.js/pull/6058/files#diff-eeaf107d189d8d1bb4f70a798575d150

Does the script also work on a touch screen for example an ipad.

Answer :
No by default there can be issues on an ipad. On the one hand with the x,y positions.

Solution :
For our projects, we modified the script " EventsControls.js" so that it works on an ipad.

Sample screenmovie pc&ipad

Testing yourself :

https://www.utilewebsites.nl/example/clicktouchthreejs/

Source code sample download :

example-threejs-click-touchscreen.zip

If node_module for e.g. Vuejs :

eventscontrols.zip