Created
June 1, 2021 18:18
-
-
Save razdvapoka/852c85982c1ea8e54e7cb61d520e404d to your computer and use it in GitHub Desktop.
scene point's screen coords
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const screenPosition = point.position.clone(); | |
screenPosition.project(camera); | |
const translateX = screenPosition.x * canvas.width * 0.5; | |
const translateY = -screenPosition.y * canvas.height * 0.5; | |
element.style.transform = `translate(${translateX}px, ${translateY}px)`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment