gpt4 book ai didi

java - ARCore TransformableNode 拖动后将 localPosition 设置为 [x=0.0, y=0.0, z=0.0]

转载 作者:行者123 更新时间:2023-12-02 10:29:43 24 4
gpt4 key购买 nike

我正在为 ARCore 创建多人游戏体验。所以我想共享设置为平面的 TransformableNodeLocalPosition

因此,当我将 TransformableNode 设置为 ParentNode 然后设置 LocalPosition 时,一切都很好,我得到了 getLocalPosition() 正确的 localPosition。

如果我现在将节点拖动到平面上的另一个点,则似乎 TransformableNode 丢失了其 ParentNode。因为拖动 node 后,我得到 getLocalPosition() -> [x=0.0, y=0.0, z=0.0] 而不是相对于父 i 的位置之前设置。

myAnchorNode.addChild(myTransformableNode);
myTransformableNode.setLocalPosition(position);
//dragging it at runtime
Vector3 x = myTransformableNode.getLocalPosition(position);
// x = [x=0.0, y=0.0, z=0.0]

最佳答案

我建议您改用此方法来获取相对位置。

https://docs.unity3d.com/ScriptReference/Transform.InverseTransformPoint.html

ARCore 在其自己的层次结构中操作许多对象,并且可能会导致冲突。

关于java - ARCore TransformableNode 拖动后将 localPosition 设置为 [x=0.0, y=0.0, z=0.0],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53683602/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com