magic-script-components icon indicating copy to clipboard operation
magic-script-components copied to clipboard

Planes Detection

Open ghost opened this issue 5 years ago • 0 comments

Description

An on-demand mechanism which allows developers to get information on JSX side about detected planes.

Solution proposal

Initial analysis shows that a flexible planes detection mechanism could be implemented as NativeModule. This solution gives developers a possibility of how to present planes and how to handle interaction with them. Additionally, with few additional JSX lines, it could provide Initial Placement feature.

// module creation
this.planeDetector = NativeModules.ARPlaneDetector;

// registering notification
this.planeDetector.addObserver(this.onDetectPlane);
this.planeDetector.addObserver(this.onPlaneDidTap);

// possible API calls 
this.planeDetector.startPlaneDetection();
this.planeDetector.startEntryMode('Tap any plane to select scene origin.', true);
this.planeDetector.getAllPlanes();
this.planeDetector.stopEntryMode();

// registered callback
onPlaneDetected = (plane, anchor) => { 

}

// registered callback
onPlaneDidTap = (plane, anchor, touch) => {

}

Completion status

ghost avatar Dec 20 '19 13:12 ghost