void SubscribeToEvents() { SubscribeToEvent <PostRenderUpdateEvent>(e => { // If draw debug mode is enabled, draw viewport debug geometry, which will show eg. drawable bounding boxes and skeleton // bones. Note that debug geometry has to be separately requested each frame. Disable depth test so that we can see the // bones properly if (drawDebug) { GetSubsystem <Renderer>().DrawDebugGeometry(false); } if (currentPath.Count > 0) { // Visualize the current calculated path DebugRenderer debug = scene.GetComponent <DebugRenderer>(); debug.AddBoundingBox(new BoundingBox(endPos - new Vector3(0.1f, 0.1f, 0.1f), endPos + new Vector3(0.1f, 0.1f, 0.1f)), new Color(1.0f, 1.0f, 1.0f), true); // Draw the path with a small upward bias so that it does not clip into the surfaces Vector3 bias = new Vector3(0.0f, 0.05f, 0.0f); debug.AddLine(jackNode.Position + bias, currentPath[0] + bias, new Color(1.0f, 1.0f, 1.0f), true); if (currentPath.Count > 1) { for (int i = 0; i < currentPath.Count - 1; ++i) { debug.AddLine(currentPath[i] + bias, currentPath[i + 1] + bias, new Color(1.0f, 1.0f, 1.0f), true); } } } }); }