threejs坐标转换

来源:互联网 发布:网络诈骗事件 编辑:程序博客网 时间:2024/05/21 02:34

坐标转换

将屏幕坐标转变成threejs空间坐标:

function transform(x,y){        let mouse = new THREE.Vector2();        mouse.x = x-window.innerWidth/2;        mouse.y = window.innerHeight/2 - y;       return mouse;}

推理看上一节【对象拾取】。

坐标增量转换

x方向增量,屏幕坐标和threejs坐标中相同,y增量相反。

let offset = {    x: currX- preX,    y: preY- currY}
0 0
原创粉丝点击