Joni Turunen
Joni Turunen

Reputation: 137

Get 2D location from 3D point

I have a THREE.Vector3 with location x, y, z of a mesh in the viewer. How can I get a corresponding 2D point on canvas? I would like to place something x, y at the same location where the 3D model is located in the viewer.

Upvotes: 1

Views: 453

Answers (1)

Augusto Goncalves
Augusto Goncalves

Reputation: 8604

Check the worldToClient(point) method (part of Autodesk.Viewing.Viewer3D), the point parameters is a THREE.Vector3 point in world space coordinates. Below is a piece of the documentation.

Calculates the pixel position in client space coordinates of a point in world space. See also clientToWorld().

Upvotes: 2

Related Questions