I’m using @prisoner849 's hover over vertice code.
I have a canvas that is not the entire display. Right now it is only 1000 / 800 and the mouse is a good distance from the object when it shows the vertices being selected.
How do I use this code to dial it to my renderer size?
@rrrr_rrrr , I mean it was the same result that I had before. It’s like 10 units away from the vertices.
@Chaser_Code No, I meant use a standard canvas size like 50% of the screen or something. so it is easier to get it. I also have a 25px margin on each side of the canvas in the upper right.
Sounds like it’s my fault that the code doesn’t work for you
Any chance to provide a minimal editable live code example, that demonstrates the problem?
Your logic is sound. The problem is OP has difficulty following some simple solutions.
I didn’t want to post these, but is seems to be wasted if not shared. test_prisoner849.html (3.3 KB) test_prototype-1.html (2.7 KB)
I’m done here!!
IMO using window.innerWidth / window.innerHeight pretty much anywhere is an antipattern since it comes with the hidden assumption that the canvas is full screen. As soon as you make a canvas that is not fullscreen/centered then you’ll run into issues like this.
The three.js examples are guilty of this and people copy the code so it gets propagated everywhere. It would be better if something like container.clientWidth / container.clientHeight was used instead (or canvas instead of container).