I am using ARKit to find horizontal plane and then cover the plane with a grid image using SCNPlane geometry. If I use the following code to update my plane extend then it works fine.
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: [:]))
}
If I adjust the planeGeometry height as shown below:
self.planeGeometry.height = CGFloat(anchor.extent.z * Float(10));
Then it displays the plane stretched out on x-axis and z-axix but for some reason the plane is also changed the position in y. Instead of right on top of the found surface it is floating above the surface.
Any ideas? I just want the plane to be larger on x-axis and z-axis and still be sitting on the surface.