Three.js project on iPhone - events issue (select&drag object )

后端 未结 1 814
执笔经年
执笔经年 2021-02-11 03:29

I have building project with three.js... canvas where you can drag object and play with the camera view as well... there is a famous example- "Draggable Cubes", well m

1条回答
  •  孤城傲影
    2021-02-11 03:59

    in this line :

    var vector = new THREE.Vector3( mouse.x, mouse.y, 0.5 );
    

    You use the mouse Vector2 object but you don't initialize it.

    Something like this should work :

    mouse.x = +(event.targetTouches[0].pageX / window.innerwidth) * 2 +-1;
    
    mouse.y = -(event.targetTouches[0].pageY / window.innerHeight) * 2 + 1;
    

    0 讨论(0)
提交回复
热议问题