【问题标题】:Three.js | controls.target.set don't work三.js | controls.target.set 不起作用
【发布时间】:2016-06-01 09:35:57
【问题描述】:

controls.target.set 有问题

解释页面:http://1id.xyz/stackoverflow/newOrbit.php

黄色环是原来的轨道,它可以工作。

如果我拖动蓝点并将controls.target 设置在新位置。 (蓝色环位置)相机不会围绕这个新目标位置运行。

为什么?

【问题讨论】:

    标签: javascript jquery three.js position draggable


    【解决方案1】:

    您使用的可拖动对象是 2D(html 元素),而您的场景是 3D。换句话说,你有屏幕坐标并且你正在寻找世界坐标。

    知道了这一点,您需要从鼠标 x,y 位置进行光线投射,并在 3D 平面上找到交点 x,y,z。

    Here's a similar question and a pointer to a possible solution.

    【讨论】:

    • Thks,但是,sorrycontrols.target 没有在 bluedot x,y 屏幕上设置,如果你愿意,我可以再举一个例子:controls.target.set(blueRing.position.x, blueRing.position.y, blueRing.position.z); 检查 console.log
    猜你喜欢
    • 1970-01-01
    • 2021-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多