magic-script-components
magic-script-components copied to clipboard
Planes Detection
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) => {
}