统一AR旋转场景以匹配参考点
如何按位置和旋转在2个不同的AR场景中匹配参考点?
以下是有关我项目的一些细节: 我有两个场景:“新扫描”和“负载扫描”。在“新扫描”场景中,我实例化了一个3D立方体,并相对于它提出了所有其他点。这是我的参考点。然后,我实例化了一些点,最后将所有数据保存到设备(我的手机)。 接下来,在“负载扫描”中,我再次加载场景,并在完全相同的世界位置上实例化立方体。目前,我设法为每个点设置了正确的位置,但是轴是旋转的,因为我从不同的现实世界位置和不同的电话旋转开始了场景。 基于在同一位置实例化的立方体,我需要匹配场景的旋转和位置,以便点将与第一个立方体相同的相对位置出现。
注意:可以假设该立方体将与用户站在与所需位置相同的方向上实例化。但是不要以为用户以与“新扫描”场景相同的方向开始“负载扫描”场景(影响整个场景旋转)。
这是问题的可视化: 新扫描的图像:
负载扫描的图像:
谢谢
How to Match a reference point in 2 different AR scenes by position and rotation?
Here are some details about my project:
I have 2 scenes: "new scan" and "load scan". In the "new scan" scene I instantiate a 3d cube and make all the other points relative to it. This is my reference point. Then I instantiate some more points and finally save all the data to the device (my phone).
Next, in "load scan" I load the scene again and instantiate the cube in the exact same world position. For now, I managed to set the right position for each point but the axis is rotated because I start the scene from a different real-world location and different phone rotation.
Based on the cubes which are instantiated in the same place, I need to match the rotation and the position of the scene so the points will appear in the same relative position as the first cube.
Note: one can assume that the cube will instantiate with the user standing in the same direction as the desired position. But Do NOT assume that the user starts the "load scan" scene in the same direction as the "new scan" scene (which effect the whole scene rotation).
Here is a visualization of the problem:
Image of New Scan:
Image of Load Scan:
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果要确保在每个AR会话中都在相同的位置 /旋转中出现多个选项:
映像标记。当然,您还可以尝试使用户正确地将立方体放置,或者在没有这些限制的情况下重新设计您的应用程序工作。
If you want to make sure that the cube will appear in the same position/rotation in every AR session you have several options:
Of course you can also try to make the user place the cube correctly themselves, or redesign your app to work without these restrictions.
因此,我找到了一个解决方案,但这不是最终的解决方案:
首先,将一个具有公共静态参数的类做一个类,以便我们可以通过其他脚本和场景。类似的事情:
现在,每次相机打开时,请检查SceneStage.Resetscene状态。如果值== 0不要做任何事情,否则要求用户面向欲望方向,然后按下一个按钮,该按钮调用函数重置:
在这里,我将场景构建索引发送到函数:
因此,基本上,流程就是这样:第一次我们打开场景(当scenEstage.Resetscene = 1时) - >将值更改为0,然后重置场景。第二次什么都不做,但是当我们离开场景时,将值设置回1,以便下一个场景也将重置(因为Arpose驱动程序仍在跟踪环境)。
So I've found a solution but this is not the ultimate solution:
First, make a class with public static parameter so we can pass it through other scripts and scenes. Something like that:
Now, every time the camera turns on, check the SceneStage.ResetScene state. If value == 0 don't do anything, otherwise ask the user to stand facing the desire direction and then press a button, which call the function ResetScene:
Here I send the scene build index to the function with:
So basically, the flow is like that: for the first time we open the scene (when SceneStage.ResetScene = 1) -> change the value to 0, and reset the scene. The second time don't do anything, but when we leave the scene set the value back to 1 so the next scene will reset too (because the ARPose driver still tracking the environment).