Set location of object using object vertex

Hello, I am trying to set the location of an object using object vertex, in other words, I need to set 1 object vertex location that equals another object vertex location.

Thanks for the reply.

Do you mean something like this?

However, examples are with the old geometry. Must be adapted.

Planes on Sphere
Move on Sphere

from the Collection of examples from discourse.threejs.org

I can’t really understand this example.


I need to make that glasses model using glasses vertex be equal to nose vertex location

Up :stuck_out_tongue:

I’m assuming you have the coordinates of the target vertices.

Face = Mesh_1; Glasses = Mesh_2
v_1 = Face_vertex; v_2 = Glasses_vertex;

First copy the component of v_1 & v_2 to new vectors.
Use localToWorld() to convert to world space.
Subtract v_1 from v_2 = v_12.
Translate Mesh_2 by v_12.

https://threejs.org/docs/#api/en/math/Vector3
https://threejs.org/docs/#api/en/core/Object3D