Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARKit 2.0 #184

Open
birkir opened this issue Jun 5, 2018 · 3 comments
Open

ARKit 2.0 #184

birkir opened this issue Jun 5, 2018 · 3 comments

Comments

@birkir
Copy link

birkir commented Jun 5, 2018

New API's exposed

With the ARWorldMap being the most anticipated feature yet in ARKit, we could expose it something like this...

Get worldMapStatus

RCT_EXPORT_VIEW_PROPERTY(onWorldMappingStatus, RCTBubblingEventBlock)

if (self.onWorldMappingStatus) {
  ARWorldMappingStatus * status = self.arView.session.currentFrame.worldMappingStatus;
  if (status != self.worldMappingStatus) {
    dispatch_async(dispatch_get_main_queue(), ^{
      self.onWorldMappingStatus(@{
               @"state": @(status),
      });
    });
    self.worldMappingStatus = status;
  }
}

Receive worldMap

RCT_EXPORT_VIEW_PROPERTY(worldMap, NSObject);
RCT_EXPORT_METHOD(getCurrentWorldMap:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
  resolve([[ARKit sharedInstance] getCurrentWorldMap:resolve reject:reject]);
}

- (void)getCurrentWorldMap:(RCTARKitResolve)resolve reject:(RCTARKitReject)reject {
  [session getCurrentWorldMapWithCompletionHandler:^(ARWorldMap * _Nullable worldMap, NSError * _Nullable error) {
    if (error) {
      reject(error);
    } else {
      resolve(worldMap);
    }
  }];
}

Usage?

// device 1
<ARKit
  onWorldMappingStatus={async ({ status }) => {
    if (status === 'ARWorldMappingStatusMapped') {
      await cloud.set(await arkit.getCurrentWorldMap());
    }
  }}
/>

// device 2
<ARKit
  worldMap={await cloud.get()}
/>
@PerspectivesLab
Copy link

when is this going to be implemented ?

@macrozone
Copy link
Collaborator

@PerspectivesLab I was not so active on the project, but I might get back to it soon. It should not be a big thing to do so.

@birkir did you try it out? if so, could you open up a pull request? then we can continue on that

@code-matt
Copy link
Collaborator

code-matt commented Feb 22, 2020

I have a PR open for this, well the worldmap sharing bit. @birkir I can't tell me how much your little snip actually helped me when I was first getting going, thanks! I do not have anchors yet which will help syncing the worldmaps greatly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants