Hello lovely people, i have problem with mixin html elements on canvas. I have created few buttons and placed them in my scene. Their point is to stay the way they are even if my camera moves but when i turn my camera 180 degrees it's still projecting on my screen flipped. Video will explain it more clearly.
My code goes like this :
const points = [ { position: new THREE.Vector3(-0.4,0.5,0.1), element: document.querySelector('.point-0') }, { position: new THREE.Vector3(-0.4,0.2,0.3), element: document.querySelector('.point-1') }, { position: new THREE.Vector3(-0.5,-0.1,-0.9), element: document.querySelector('.point-2') } ]
in animate function:
`for(const point of points)
{
const screenPosition = point.position.clone()
screenPosition.project(camera)
const translateX = screenPosition.x * sizes.width * 0.5
const translateY = - screenPosition.y * sizes.height * 0.5
point.element.style.transform = `translateX(${translateX}px) translateY(${translateY}px)`
}`
Any help is appreciated.