I haven’t been succesful in how to position a DIV on top of a BoxBufferGeometry.
The camera must be oriented in front of geometry -> frontal view is rectangular (prerequisite).
This should return on screen coordinates of an objects center:
getOnScreenCoords(object){
localPoint = new THREE.Vector3()
var p = object.localToWorld(localPoint);
camera.updateMatrixWorld();
p.project( camera );
return( p );
}
localpoint being the center, is 0,0,0 in this example but you’d change this for the corners of the object.
Thank you for your prompt reply, but unfortunately this makes no difference. There is still something causing the center point to be off-center.
see https://jsfiddle.net/jsfiddle_lyke_be/w3n5e1tr/2/
for a revision with your suggestion included.