I need to get the world position of faces in a mesh. This is my code for this:
var that = this,
addPoint,
geometry = mesh.geometry,
worldPos = mesh.getWorldPosition();
that.allMeshes[mesh.uuid] = {
mesh: mesh,
points: {}
};
addPoint = function (currPoint, face) {
var point = that.octree.add([worldPos.x + currPoint.x, worldPos.y + currPoint.y, worldPos.z + currPoint.z], {mesh: mesh, geometry: geometry, face: face});
that.allMeshes[mesh.uuid].points[point.id] = point;
};
geometry.faces.forEach(function(face) {
//Get the faces points cords
addPoint(geometry.vertices[face.a], face);
addPoint(geometry.vertices[face.b], face);
addPoint(geometry.vertices[face.c], face);
}, this);
This all works very well unless the parent mesh is scaled then. Does anyone know how to solve this?