There’s also an option to check UV coordinates of point of intersection, and if it’s in a predefined rectangle, then do some stuff. The hardest part here is to find coordinates of the predefined rectangle You need 4 clicks for it with logging of uv coordinates though
Search the code for cssRenderer to find the new parts, and take a look at each size or position number being 1000x bigger.
The reason the sizes must be bigger is because a DOM elements can not be smaller than 1 unit (CSS pixels), and your size was 0.7, 0.2. At that size, you can’t get precise DOM sizing. So by changing it to 700 and 200 the sizing works.
But I broke some stuff (now the text is far out from the wall) but you can take it from there. The button works!
But now you may want to tune the material for the css3d object mesh (the mesh returned from the makeElementObject function, to configure how transparent you want it to be, so that you can see the content of the button.
You get an error in the console ( Button example, but it works ): THREE.OrbitControls: “document” should not be used as the target “domElement”. Please use “renderer.domElement” instead.
I corrected it in the copy.
//var controls = new THREE.OrbitControls(camera, document); // error in console … Please use “renderer.domElement” instead.
var controls = new THREE.OrbitControls(camera, renderer.domElement); // changed hofk
Weird.
Browser: With Firefox the click only works when I open the console.
With Chrome, Opera immediately.
That would certainly not be bad, but I can’t afford that at the moment. See the Discussion about this side link at the bottom of * discourse.threejs.hofk.de
It also takes time to read, especially since my English is still poor and I use a translator:
But maybe someone who has already done such a thing would like to add it? Then please contact me.