3d 在现实生活中,如何在arcore中放置椅子对象,使其具有椅子的精确大小?

3d 在现实生活中,如何在arcore中放置椅子对象,使其具有椅子的精确大小?,3d,augmented-reality,arcore,sceneform,3d,Augmented Reality,Arcore,Sceneform,我想使用sceneform在arcore中放置一把椅子,这样它就可以像真正的椅子一样占据房间的确切空间。我在arcore项目中工作过。 我必须以厘米为单位显示真实世界的大小。 所以我使用下面的代码 Box box = (Box) transformableNode.getRenderable().getCollisionShape(); Vector3 size = box.getSize(); Vector3 transformableNodeScale = tran

我想使用sceneform在arcore中放置一把椅子,这样它就可以像真正的椅子一样占据房间的确切空间。

我在arcore项目中工作过。
我必须以厘米为单位显示真实世界的大小。
所以我使用下面的代码

    Box box = (Box) transformableNode.getRenderable().getCollisionShape();
    Vector3 size = box.getSize();

    Vector3 transformableNodeScale = transformableNode.getWorldScale();


    Vector3 finalSize =
            new Vector3(
                    (float) (Math.round((size.x * transformableNodeScale.x * 100) * 10) / 10.0),
                    (float) (Math.round((size.y * transformableNodeScale.y * 100) * 10) / 10.0),
                    (float) (Math.round((size.z * transformableNodeScale.z * 100) * 10) / 10.0));


    x_cm = String.valueOf(finalSize.x); //세로
    y_cm = String.valueOf(finalSize.y); //높이
    z_cm = String.valueOf(finalSize.z); //가로
    mtextView.setText("( 가로 : " + z_cm + "cm " + "세로 : " + x_cm + "cm " + "높이 : " + y_cm +"cm )");
因此,添加一些解释,创建一个覆盖当前渲染模型的框,
并获得它的世界规模。
由于Unity使用的是米,请将其转换为厘米,并在屏幕上显示尺寸

我不确定它是否会起作用,但我想你可以用这个
并在缩放模型时使用它(可能从用户(seekbar等)获取输入)


如果这台不能满足您的需要,很抱歉。

您使用的是什么发动机?Unity、Unreal等?我从poly网站下载了模型,并使用android studio在sceneform中渲染