以ARKit表示的iOS平面范围高度

以ARKit表示的iOS平面范围高度,ios,swift,scenekit,augmented-reality,arkit,Ios,Swift,Scenekit,Augmented Reality,Arkit,我使用ARKit找到水平面,然后使用SCNPlane几何体用网格图像覆盖平面。如果我使用下面的代码来更新我的平面扩展,那么它可以正常工作 func update(anchor: ARPlaneAnchor) { self.planeGeometry.width = CGFloat(anchor.extent.x * Float(scaleX)); // scaleX is 10 self.planeGeometry.height = CGFloat(anchor.extent.

我使用ARKit找到水平面,然后使用SCNPlane几何体用网格图像覆盖平面。如果我使用下面的代码来更新我的平面扩展,那么它可以正常工作

func update(anchor: ARPlaneAnchor) {

    self.planeGeometry.width = CGFloat(anchor.extent.x * Float(scaleX)); // scaleX is 10
    self.planeGeometry.height = CGFloat(anchor.extent.z);
    self.position = SCNVector3Make(anchor.center.x, 0, anchor.center.z);

    let planeNode = self.childNodes.first!  
    planeNode.physicsBody = SCNPhysicsBody(type: .kinematic, shape: SCNPhysicsShape(geometry: self.planeGeometry, options: [:]))
} 
如果我调整平面几何体高度,如下所示:

self.planeGeometry.height = CGFloat(anchor.extent.z * Float(10));
然后显示在x轴和z轴上拉伸的平面,但由于某些原因,该平面在y轴上的位置也发生了更改。它不是在找到的曲面的正上方,而是在曲面上方浮动

有什么想法吗?我只希望平面在x轴和z轴上更大,并且仍然在表面上

我想看看你是如何创建平面的。它的
transform
/
pivot
可能直接或在父节点中出错。