I'm working on an addon to distort the backsides of a mesh along a direction. I'm using a dot product with each vertex's normal to determine whether or not that vertex should or should not be affected, and by how much. This works 100% perfectly if you only move or scale the object, but if you rotate it without applying the rotation, there are issues with the direction not changing.
Here is my code for getting the normals
def global_verts(_obj): out_verts =  out_norms =  mat = _obj.matrix_world depsgraph = bpy.context.evaluated_depsgraph_get() mesh = _obj.to_mesh(preserve_all_data_layers=True, depsgraph=depsgraph) for vert in mesh.vertices: out_norms.append(vert.normal) out_verts.append(mat @ vert.co) return np.array(out_verts), np.array(out_norms)
This should give me the updated mesh, but when I test if these normals are equal to the original object, it returns as true. So far I have tried multiplying the normals by
matrix_basis, using multiple different methods of getting the mesh, and setting the mesh vertices to world space and then getting the normals, none of which have worked. Is there any way that I could get the applied normals for a mesh, not just for rotates objects but also for rigged ones as well?