简体   繁体   English

ARCore model 尺寸

[英]ARCore model size

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.我试图将 3D Model 放入 ARCore 框架中,但是当我要放置 model 时,它变得过大并且没有出现在屏幕中央。 I don't want to place it with a tap, the app places the model automatically.我不想点击放置它,应用程序会自动放置 model。

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.用 3D 软件查看你的 model 的尺寸,在 ARCore 中,虚拟世界中的 1 个单位相当于现实世界中的 1 米。

Looks like you're using Sceneform, is this correct?看起来您正在使用 Sceneform,这是正确的吗? You can scale your Node easily through setWorldScale(Vector3) or setLocalScale(Vector3) .您可以通过setWorldScale(Vector3)setLocalScale(Vector3)轻松扩展您的节点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM