The next method is the CreateSubPlane() method. When the application finds a plane on which we can place objects, it will create a node. We will write that code specifically for each platform soon. This node also defines a subplane that will position a box, representing the position and size of that plane. We have already defined the PlaneNode class earlier in this chapter.
Let's add the code by going through the following steps:
- In the WhackABox project, open the Game.cs class.
- Add the following CreateSubPlane() method to the class:
protected void CreateSubPlane(PlaneNode planeNode)
{
var node = planeNode.CreateChild("subplane");
node.Position = new Vector3(0, 0.05f, 0);
var box = node.CreateComponent<Box>();
box.Color = Color.FromHex("#22ff0000");
}
Any class inheriting from Urho.Node, such as PlaneNode, has the CreateChild() method. This allows us to create a child node and specify a name for that node. That...