status.cc:153通用::失败的前提条件: ARCoreError:third_party/arcore/ar/core/session.cc@1668 无法创建锚点。
private void drawVector(Vector3 objVector){
Frame frame = arFragment.getArSceneView().getArFrame();
if (frame == null) {
return;
}
if (frame.getCamera().getTrackingState() != TrackingState.TRACKING) {
return;
}
float[] position=new float[]{(float)objVector.x,(float)objVector.y,(float)objVector.z};
Pose pose=new Pose(position,new float[]{0,0,0,1});
Session session=arFragment.getArSceneView().getSession();
// the error occuer here
**Anchor anchor=session.createAnchor(pose);**
anchorsCollec.add(anchor);
AnchorNode anchorNode=new AnchorNode(anchor);
anchorNode.setParent(arFragment.getArSceneView().getScene());
// Create the transformable andy and add it to the anchor.
TransformableNode andy = new TransformableNode(arFragment.getTransformationSystem());
andy.setParent(anchorNode);
andy.setRenderable(andyRenderable);
}
//start arSession
onStart() {
Scene.OnUpdateListener onUpdateListener=frameTime->{
drawVector(new Vector3(1,1,1))
}
scene.addOnUpdateListener(onUpdateListener);
}