diff --git a/source/blender/editors/transform/transform_snap_object_editmesh.cc b/source/blender/editors/transform/transform_snap_object_editmesh.cc index d40d5e9463e..f0088035e69 100644 --- a/source/blender/editors/transform/transform_snap_object_editmesh.cc +++ b/source/blender/editors/transform/transform_snap_object_editmesh.cc @@ -416,8 +416,9 @@ static bool nearest_world_editmesh(SnapCache_EditMesh *em_cache, return false; } - float3 init_co = math::transform_point(obmat, float3(sctx->runtime.init_co)); - float3 curr_co = math::transform_point(obmat, float3(sctx->runtime.curr_co)); + float4x4 imat = math::invert(obmat); + float3 init_co = math::transform_point(imat, float3(sctx->runtime.init_co)); + float3 curr_co = math::transform_point(imat, float3(sctx->runtime.curr_co)); BVHTreeNearest nearest{}; nearest.dist_sq = sctx->ret.dist_px_sq; diff --git a/source/blender/editors/transform/transform_snap_object_mesh.cc b/source/blender/editors/transform/transform_snap_object_mesh.cc index e53f97e6bc3..af77ad631ce 100644 --- a/source/blender/editors/transform/transform_snap_object_mesh.cc +++ b/source/blender/editors/transform/transform_snap_object_mesh.cc @@ -231,8 +231,9 @@ static bool nearest_world_mesh(SnapObjectContext *sctx, return false; } - float3 init_co = math::transform_point(obmat, float3(sctx->runtime.init_co)); - float3 curr_co = math::transform_point(obmat, float3(sctx->runtime.curr_co)); + float4x4 imat = math::invert(obmat); + float3 init_co = math::transform_point(imat, float3(sctx->runtime.init_co)); + float3 curr_co = math::transform_point(imat, float3(sctx->runtime.curr_co)); BVHTreeNearest nearest{}; nearest.dist_sq = sctx->ret.dist_px_sq;