用手势翻译后如何获得实体位置?
在这样的翻译之后,我正在尝试获得实体的变换矩阵:
uiView.scene.findEntity(named: "Model_Name")?.transform.matrix
我将3D模型移动到场景中,然后再次调用此方法,并且矩阵仍然相同。因此,我无法获得3D模型的最新变换矩阵。
这是我创建一个实体的方式:
var anchorEntity = AnchorEntity()
anchorEntity = AnchorEntity(.plane(.any,
classification: .any,
minimumBounds: [0.1, 0.1]))
anchorEntity.addChild(MyEntity, preservingWorldTransform: true)
uiView.scene.addAnchor(anchorEntity)
实体的最新位置(X,Y,Z)
guard let translateGesture = recognizer as? EntityTranslationGestureRecognizer
else { return }
let position = translateGesture.location(in: translateGesture.entity)
我可以通过EntityTranslationTranslationTranslation fasturerEcognizer获得 我的3D型号的位置?
I am trying to get the transform matrix of an Entity after a translation like this:
uiView.scene.findEntity(named: "Model_Name")?.transform.matrix
I move the 3D model around the scene and i call this method again and the matrix is still the same. So i can't get the latest transform matrix of my 3D model.
This is the way I create an Entity:
var anchorEntity = AnchorEntity()
anchorEntity = AnchorEntity(.plane(.any,
classification: .any,
minimumBounds: [0.1, 0.1]))
anchorEntity.addChild(MyEntity, preservingWorldTransform: true)
uiView.scene.addAnchor(anchorEntity)
I can get the latest position (X,Y,Z) of the Entity via EntityTranslationGestureRecognizer
guard let translateGesture = recognizer as? EntityTranslationGestureRecognizer
else { return }
let position = translateGesture.location(in: translateGesture.entity)
Is there any way to get the latest transform matrix of an Entity because I want to create an ArAnchor in the latest position of my 3D model?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论