Native meshing not working


We have problems retrieving MLMeshingMeshInfo with MLMeshingGetMeshInfoResult().
The MLMeshingGetMeshInfoResult() method returns MLResult_Ok, but out_info.data_count is set to zero. We have ensured that subsequent calls are made in the same way as in the sample app.
We have made sure that each call returns MLResult_Ok.
Do you have an idea why data_count is zero even though MLResult_Ok is returned.
Especially as the documentation mentions MLResult_Ok is returned when the data was populated.

\retval MLResult_Ok Mesh Info was populated successfully.

ML2 OS version 1.3.0-dev1(secure)
MLSDK version v1.2.0-dev2

Thanks in advance,

Richard, did you try running meshing sample app? Does it work for you?

Hi @ejurinsky,

Yes, the sample is working.
We granted all permissions, using the code from the sample and also starting perception with MLPerceptionStartup().

We tried to test meshing using minimal code now. Our source looks like this:

At startup:
// initialize perception system
MLPerceptionSettings perceptionSettings = {};
MLResult result = MLPerceptionInitSettings(&perceptionSettings); // result = MLResult_Ok
result = MLPerceptionStartup(&perceptionSettings); // result = MLResult_Ok
result = MLMeshingCreateClient(&meshing_client_, &meshing_settings_); // result = MLResult_Ok
result = MLHeadTrackingCreate(&head_tracker_); // result = MLResult_Ok
result = MLHeadTrackingGetStaticData(head_tracker_, &head_static_data_); // result = MLResult_Ok

onUpdate() {
  if (!MLHandleIsValid(current_mesh_info_request_)) {
    MLResult result = MLMeshingRequestMeshInfo(meshing_client_, &request_extents_, &current_mesh_info_request_); // result = MLResult_Ok
  } else {
    MLMeshingMeshInfo mesh_info = {};
    MLResult result = MLMeshingGetMeshInfoResult(meshing_client_, current_mesh_info_request_, &mesh_info); // result = MLResult_Ok
    // result = MLResult_Ok, mesh_info.data_count=0,>state=0 //
    switch (result) {
        case MLResult_Ok:
            LOGAR_DEBUG<<"##### mesh data count = " << mesh_info.data_count << " timestamp: " << mesh_info.timestamp << " state: " <<>state;
        case MLResult_Pending:
            LOGAR_DEBUG<<"##### meshinfo pending”; // never comes in here
        case MLResult_PerceptionSystemNotStarted:
            LOGAR_DEBUG << "##### MLResult_PerceptionSystemNotStarted”; // never comes in here
        case MLResult_InvalidParam:
            LOGAR_DEBUG << "##### MLMeshingGetMeshInfoResult MLResult_InvalidParam”; // never comes in here
            LOGAR_DEBUG << "##### MLMeshingGetMeshInfoResult default”; // never comes in here
  • All the Magic Leap calls are returning MLResult_Ok.
  • It looks like MLMeshingGetMeshInfoResult() does not return/update mesh_info at all.
  • In contrast to the meshing sample, MLMeshingRequestMeshInfo() never returns MLResult_Pending for us.
  • Nor does it update the result.

I’m sure we are missing something.



I found the issue:
We forgot to initialise request_extents_, which is used by
MLMeshingRequestMeshInfo(meshing_client_, &request_extents_, &current_mesh_info_request_);

When initialising it properly, it’s working!


Glad to hear @rp1. Best of luck with your project.