Both ARKit and ARCore update planes continuously. What we are interested in are changes in the position of a subplane and the extent of it. By extension, we are referring to the size of the plane. Let's set this up by going through the following steps:
- In the WhackABox project, open the Game.cs class.
- Add the UpdateSubPlane() method in the code anywhere in the Game.cs class, as shown in the following code snippet:
protected void UpdateSubPlane(PlaneNode planeNode, Vector3 position)
{
var subPlaneNode = planeNode.GetChild("subplane");
subPlaneNode.Scale = new Vector3(planeNode.ExtentX, 0.05f,
planeNode.ExtentZ);
subPlaneNode.Position = position;
}
The method takes the PlaneNode instance that we want to update, along with a new position for it. We locate the subplane by querying the current node for any node called "subplane". Remember that we named the subplane in the AddSubPlane() method. We can now easily access...