[英]ARCore TransformableNode sets localPosition to [x=0.0, y=0.0, z=0.0] after dragging
我正在為ARCore創建多人游戲體驗。 所以我想共享設置為平面的TransformableNode
的LocalPosition
。
所以,當我為我設置TransformableNode
到ParentNode
,然后設置LocalPosition
,一切正常,我也得到與getLocalPosition()
正確localPosition。
如果現在將節點拖到飛機上的另一個點,則似乎TransformableNode
失去了其ParentNode
。 因為在拖動node
后,我得到的是getLocalPosition() -> [x=0.0, y=0.0, z=0.0]
而不是相對於我先前設置的父級的位置。
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在其自己的層次結構中操縱許多對象,可能會引起沖突。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.