Danny Fox Danny Fox - 1 year ago 391
Javascript Question

How to get the absolute position of a vertex in three.js?

As far as I know

var point = object.geometry.vertices[i];
will return with the relative position for the
of the point inside the geometry of the object.

How to get the absolute position, if the object was moved, rotated or scaled?

Answer Source

First make sure the object's matrices have been updated.


The render loop usually calls this for you.

Then, do this:

var vector = object.geometry.vertices[i].clone();

vector.applyMatrix4( object.matrixWorld );

The vector will now contain the position in world coordinates.

You might want to read some CG reference books.

  1. 3D math primer for graphics and game development / by Fletcher Dunn and Ian Parberry

  2. Essential Mathematics for Games and Interactive Applications: A Programmer’s Guide James M. Van Verth and Lars M. Bishop

three.js r69

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download