Danny Fox Danny Fox - 5 months ago 82x
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?


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