How to determine the direction and change the angle of view according to two points in 3D?

First of all, there is an initial location point point1 = new THREE.Vector3 in

3D, and there is also a corresponding viewpoint now. When I randomly click on other points, I get the second point point2 = new THREE.Vector3 (x2Magnegy y2jinz2). Now I want to change the viewpoint according to the connection between the two points as the direction, mainly to change the position and target. Now I want to ask you how to find target.

Mar.30,2022

I'm not sure what you want to do
, but if you just want the camera to look in a direction parallel to two points

camera.position.x = point2.x - point1.x
camera.position.y = point2.y - point1.y
camera.position.z = point2.z - point1.z

that's fine

Menu