javascript - How to Detect collision of Cube Mesh with browser boundary in ThreeJS -


i new in 3d games , threejs. shown in image above. mesh @ browser's left boundry , @ time mesh position -1035 instead of 0. means mesh.position.x in threejs not browser window x pixel mesh.position.x in threejs. there calculation convert browser inner width , height same mesh.position.x. how detect collision browser boundary .
three.js uses 3d spatial coordinate system x , z axes horizontal , y axis vertical. origin (0, 0, 0) arbitrary point in space, , can "look around" in 3d world origin might not on screen. coordinates of object in three.js-space also, intents , purposes, arbitrary units.
you can convert between 2d screen space , 3d world space using projectors. going 3d 2d has been answered, , there nice tutorial on topic.
so, find out whether mesh on screen, should project 3d position 2d screen space , check whether outside size of window or canvas.
Comments
Post a Comment