How to get position from mesh vertex data

I have this function that creates a mesh and then applies vertex data to it
export function createCustomMeshFormVertexData(vertexData: VertexData, scene: Scene): Mesh {
vertexData.normals =
VertexData.ComputeNormals(vertexData.positions, vertexData.indices, vertexData.normals)
const mesh = new Mesh(‘mesh’, scene)
vertexData.applyToMesh(mesh, true)
return mesh
however when i go to get this mesh’s position elsewhere its showing as 0,0,0 . is there anyway to use the vertex data to get a mesh’s position?

In this snippet you don’t update the mesh’s position, you assign its vertices positions (number array).

You can get the vertices positions (number array) with


If all worked well that’s where you will find the vertices positions (number array).

I don’t think using VertexData to get a mesh’s position (vector3) make sense, the VertexData is not an object instantiated in the scene, it has no transform.

1 Like