0

How to change vertice position of mesh from global coordinates, and after it set it to local mesh coordinates (Mesh can be with different position, scale, rotation).

Let say we want to move object vertice in x axis. So we get global position of it, increase x value, but somehow we need to make it to act as local mesh position from global to local mesh.

// Get global vertice position
var vector = mesh.geometry.vertices[i].clone();
vector.applyMatrix4( mesh.matrixWorld );

// Change vertice position in global
vector.x += 0.1;

// Set new vertice position to become local
// vector = ?

// Set new vertice position
mesh.geometry.vertices[i].x = vector.x;
mesh.geometry.verticesNeedUpdate = true;
wyy
  • 515
  • 2
  • 4
  • 18

1 Answers1

0

-> answer

object.localToWorld( vector );
object.worldToLocal( vector );
Community
  • 1
  • 1
wyy
  • 515
  • 2
  • 4
  • 18