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());
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)
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.