javascript - How to load the 3D model (JSON) on current mouse position in Three.JS? -



javascript - How to load the 3D model (JSON) on current mouse position in Three.JS? -

i'm trying accomplish functionality load 3d model on current mouse coordinates. i'm using jquery drag , drop functionality load 3d model. can load model canvas, not snapping mouse coordinates.

i've used below code convert 2d mouse coordinates 3d coordinates it's not providing exact position.

function 2dto3dspace(event) { var planez = new three.plane(new three.vector3(1500, 1500, 1500), 0); var mv = new three.vector3((event.clientx / window.innerwidth) * 2 - 1, -(event.clienty / window.innerheight) * 2 + 1, 0.5); var raycaster = projector.pickingray(mv, camera); var pos = raycaster.ray.intersectplane(planez); homecoming pos; }

make sure utilize mouse position relative canvas elemente.

see this thread.

javascript three.js

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -