I am working on a code to retrieve the world position of faces in a mesh. Here is my implementation:
var newReference = this,
addPointCords,
targetGeometry = currentMesh.geometry,
finalPosition = currentMesh.getWorldPosition();
newReference.allMeshes[currentMesh.uuid] = {
mesh: currentMesh,
points: {}
};
addPointCords = function (currentPoint, face) {
var calculatedPoint = newReference.octree.add([finalPosition.x + currentPoint.x, finalPosition.y + currentPoint.y, finalPosition.z + currentPoint.z], {mesh: currentMesh, geometry: targetGeometry, face: face});
newReference.allMeshes[currentMesh.uuid].points[calculatedPoint.id] = calculatedPoint;
};
targetGeometry.faces.forEach(function(face) {
//Retrieve the coordinates of the face's points
addPointCords(targetGeometry.vertices[face.a], face);
addPointCords(targetGeometry.vertices[face.b], face);
addPointCords(targetGeometry.vertices[face.c], face);
}, this);
Everything works smoothly but encounters issues when the parent mesh is scaled. Any suggestions on addressing this challenge?