Skip to content

detectedPlanes throws exception, detection of feature availability is not graceful #30

@Maksims

Description

@Maksims

Currently, it is possible to detect if the platform supports Plane Detection by checking the availability of XRPlane in window.
Once the session has started, and the first XRFrame is provided by XRSession, the only way to check if plane-detection feature is available, is to attempt to get detectedPlanes from XRFrame, and try/catch to identify if it is available.
Most other APIs have a better way to detect availability and do not follow try/catch pattern.

It would be more graceful if detectedPlanes would equal null if the feature is not available, instead of throwing an exception when checking the value of it. Especially while it is not a function, but a property.

Current approach (by the spec):

let planes;
try {
    planes = frame.detectedPlanes;
} catch(ex) {
    return;
}

Proposed approach:

const planes = frame.detectedPlanes;
if (planes === null)
    return;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions