Skip to content

Instantly share code, notes, and snippets.

@112KA
Created May 7, 2022 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 112KA/e210d36218d6a0780cd64d76ebf345df to your computer and use it in GitHub Desktop.
Save 112KA/e210d36218d6a0780cd64d76ebf345df to your computer and use it in GitHub Desktop.
Screen to world point
function _onTouchMove(e) {
_mousePosition
//マウススクリーン位置
.set(
(e.clientX / window.innerWidth) * 2 - 1,
-(e.clientY / window.innerHeight) * 2 + 1,
0
)
.unproject(camera)
.sub(camera.position)
.normalize()
.multiplyScalar(camera.position.length())
.add(camera.position);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment