The base class of the Game class provides some virtual methods that we can override. One of these is Start(), which will be called shortly after the custom renderer has set up the UrhoSurface.
Add the method by going through the following steps:
- In the WhackABox project, open the Game.cs file.
- Add the Start() method anywhere in the class, as shown in the following code snippet:
protected override void Start()
{
scene = new Scene(Context);
var octree = scene.CreateComponent<Octree>();
InitializeCamera();
InitializeLights();
InitializeRenderer();
InitializeAR();
}
The scene that we have been talking about is created here in the first line of the method. This is the scene that we look at when UrhoSharp is running. It keeps track of all nodes that we add to it. All 3D games in UrhoSharp need an Octree, which is a component that implements spatial partitioning. It is used by the 3D engine to...