Three.js | controls.target.set不起作用

时间:2021-12-22 04:26:28

I've a problem with controls.target.set

我对controls.target.set有一个问题

A page to explain : http://1id.xyz/*/newOrbit.php

一个解释的页面:http://1id.xyz/*/newOrbit.php

The yellow ring is the original orbit, it work.

黄色环是原始轨道,它起作用。

If i drag the blue dot and set the controls.target on a new position. (the blue ring position) the camera don't orbit around this new target position.

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

Why ?

1 个解决方案

#1


0  

The draggable you're using is 2D (html element) and your scene is 3D. In other words, you have screen coordinates and you're looking for world coordinates.

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

Knowing this, you'll need to raycast from your mouse x,y position and find the intersection point x,y,z on your 3D plane.

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

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

这是一个类似的问题和指向可能解决方案的指针。

#1


0  

The draggable you're using is 2D (html element) and your scene is 3D. In other words, you have screen coordinates and you're looking for world coordinates.

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

Knowing this, you'll need to raycast from your mouse x,y position and find the intersection point x,y,z on your 3D plane.

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

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

这是一个类似的问题和指向可能解决方案的指针。