英文:
ARCore model size
问题
我正在尝试将一个3D模型放入ARCore框架中,但是当我要放置这个模型时,它会变得过大,并且不会出现在屏幕中央。我不想通过点击来放置它,应用会自动地放置这个模型。
Anchor newMarkAnchor = session.createAnchor(frame.getCamera().getPose().compose(Pose.makeTranslation(0, 0, -0.5f)).extractTranslation());
AnchorNode addedAnchorNode = new AnchorNode(newMarkAnchor);
ModelRenderable.builder().setSource(getApplicationContext(), R.raw.imac).build().thenAccept(modelRenderable -> renderable = modelRenderable).exceptionally(throwable -> {Log.i("asdasdasd", "error: "+throwable.getLocalizedMessage());
return null;
});
addedAnchorNode.setRenderable(renderable);
addedAnchorNode.setParent(arSceneView.getScene());
英文:
I'm tring to put a 3D Model into an ARCore Frame, but when I'm going to place the model it comes oversized and does not appear at the center of the screen. I don't want to place it with a tap, the app places the model automatically .
Anchor newMarkAnchor = session.createAnchor(frame.getCamera().getPose().compose(Pose.makeTranslation(0, 0, -0.5f)).extractTranslation());
AnchorNode addedAnchorNode = new AnchorNode(newMarkAnchor);
ModelRenderable.builder().setSource(getApplicationContext(), R.raw.imac).build().thenAccept(modelRenderable -> renderable = modelRenderable).exceptionally(throwable -> {Log.i("asdasdasd", "errore: "+throwable.getLocalizedMessage());
return null;
});
addedAnchorNode.setRenderable(renderable);
addedAnchorNode.setParent(arSceneView.getScene());
答案1
得分: 1
检查您的模型在3D软件中的尺寸,在ARCore中,虚拟世界中的1个单位相当于现实世界中的1米。
看起来您正在使用Sceneform,是吗?您可以通过setWorldScale(Vector3)
或setLocalScale(Vector3)
轻松地缩放您的节点。
英文:
Check the dimensions of your model with 3D software, in ARCore 1 unit in the virtual world is equivalent to 1 meter in the real world.
Looks like you're using Sceneform, is this correct? You can scale your Node easily through setWorldScale(Vector3)
or setLocalScale(Vector3)
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论