@Override
    public void onTreeUpdate() {
        super.onTreeUpdate();

        /*
         If this node is an anchor itself (e.g. a plane), then don't parent it with an anchor, as it's
         already tracked by ARCore.
         */
        if (mNodeJni == null || mNodeJni instanceof ARNode) {
            return;
        }

        /*
         If there is already an anchoring attempt in process, cancel it.
         */
        if (mAnchorAttempt != null) {
            mAnchorAttempt.cancel();
        }

        /*
         If this node is at the root of an ARScene, then we will try to create an anchor for the
         VRONode and make the VRONode a child of the anchor. This ensures ARCore stability.
         */
        ViewParent parent = getParent();
        if (parent instanceof VRTARScene) {
            if (mAnchor == null) {
                mAnchorAttempt = new AnchorAttempt(this, new Vector(mPosition));
                mAnchorAttempt.makeAttempt();
            }
        }

        /*
         If this node *was* an anchor but now has a different parent, remove the intermediate
         anchor.
         */
        else if (mAnchor != null) {
            if (parent == null || !(parent instanceof VRTARScene)) {
                if (DEBUG_ANCHORING) {
                    Log.i(TAG, "Anchored node " + this + " is being removed or repurposed, detaching anchor");
                }
                mAnchor.detach();

                // The Node may already be torn down
                if (mNodeJni != null) {
                    mNodeJni.setPosition(new Vector(mPosition));
                }
            }
        }
    }
This function creates a Node object. Child classes should override to provide
     their own Node.
android/viro_bridge/src/main/java/com/viromedia/bridge/component/node/VRTNode.java