我使用HelloSceneform示例,该怎么做?我希望在不带平面的情况下基于相机在一定距离处创建对象,并且在执行应用程序以查看所需对象时会如何? 我不熟悉arcore函数的用法。
Vector3 testve =new Vector3(0f,0,-2f);
Vector3 myve=new Vector3().zero();
MaterialFactory
.makeOpaqueWithColor(this,new Color(android.graphics.Color.RED))
.thenAccept(material -> {
ModelRenderable renderable =
ShapeFactory.makeSphere(
1f,
new Vector3(0f,1f,0f),material
);
Node node=new Node();
node.setParent(arFragment.getArSceneView().getScene());
node.setRenderable(andyRenderable);
arFragment.getArSceneView().getScene().addOnUpdateListener(frameTime -> {
Camera camera =arFragment.getArSceneView().getScene().getCamera();
camera.setLocalPosition(myve);
Vector3 cameravector=camera.worldToScreenPoint(myve);
Vector3 ray;
camera.setLocalPosition(testve);
node.setLocalPosition(testve);
});
});
创建功能节点正确吗?