.. include:: definitions.rstinc .. _debug-rendering-label: =============== Debug Rendering =============== .. figure:: images/debug_rendering/debug_rendering_wheellloader.jpg :alt: Web Debugger Wheel Loader DL300. :target: _images/debug_rendering_wheellloader.jpg Debug rendering is a way to visually inspect the state of the underlying AGX Dynamics Simulation during runtime. |AGXUnreal| offers few different debug rendering tools: * :ref:`web-debugger-label` - shows AGX debug rendering information in the browser in a 3D-view. * :ref:`draw-shape-contacts-label` - draw Shape contact points in the viewport in Unreal Engine. * :ref:`remote-debugging-label` - allows the default viewer in AGX ``AGXViewer`` to connect to a Simulation running in |AGXUnreal| and display its debug rendering information. The subsections below outlines how to use each of these tools. .. _web-debugger-label: ************ Web Debugger ************ .. note:: The Web Debugger is currently only supported on Windows. To start the Web Debugger during Play, in the AGX top menu, select the ``Toggle Web Debugger`` option. .. figure:: images/debug_rendering/agx_menu_web_debugger.jpg :alt: Toggle the Web Debugger from the AGX top menu. :target: _images/agx_menu_web_debugger.jpg Toggle the Web Debugger from the AGX top menu. This will start the Web Debugger and automatically open a web browser window where the 3D view is displayed. .. figure:: images/debug_rendering/web_debugger_view.jpg :alt: Web Debugger view in web browser. :target: _images/web_debugger_view.jpg Web Debugger view in web browser. The Web Debugger consists of two parts: a web server and a web debugger interface (client). To specify the port number used by the web server and web debugger interface (client), select ``Edit > Project Settings... > Plugins > AGX Dynamics`` and look under the ``Debug`` category. .. figure:: images/debug_rendering/settings_web_debugger.jpg :alt: Web Debugger settings in project settings. :target: _images/settings_web_debugger.jpg Web Debugger settings in project settings. By selecting ``Web Debugger`` as the ``Debugging Mode``, the Web Debugger will always be started when a Simulation is started. The Web Debugger view will automatically open in a browser on Play. To turn off this behavior, disable the option ``Open Web Debugger View in Browser on Play``. The Web Debugger can be started from the AGX top menu even if the ``Debugging Mode`` is set to None, and it will use the Port values specified in the Plugin Settings. The Web Debugger can also be started from Blueprint (or C++), meaning it can be used in cooked (stand-alone) builds. .. figure:: images/debug_rendering/enable_web_debugging_bp.jpg :alt: Enabling Web Debugger from Blueprint. :target: _images/enable_web_debugging_bp.jpg Enabling Web Debugger from Blueprint. .. _draw-shape-contacts-label: ******************* Draw Shape Contacts ******************* To enable the Draw Shape Contacts feature, select the ``Toggle Draw Shape Contacts`` option from the AGX top menu during Play. .. figure:: images/debug_rendering/agx_menu_draw_shape_contacts.jpg :alt: Toggle Draw Shape Contacts from AGX top menu. :target: _images/agx_menu_draw_shape_contacts.jpg Toggle Draw Shape Contacts from AGX top menu. When enabled, this will draw Shape Contacts as small orange spheres in the Viewport: .. figure:: images/debug_rendering/contacts_rendering.jpg :alt: Contacts beeing rendered to the screen. :target: _images/contacts_rendering.jpg Contacts beeing rendered to the screen. If enabled in the Project Settings, this will always be enabled during Play. This option can also be enabled or disabled from ``Edit > Project Settings... > Plugins > AGX Dynamics`` under the ``Debug`` category: .. figure:: images/debug_rendering/settings_draw_shape_contacts.jpg :alt: Enabling the Draw Shape Contacts setting. :target: _images/settings_draw_shape_contacts.jpg Enabling the Draw Shape Contacts setting. If enabled in the Project Settings, this will always be enabled during Play. The ``Draw Shape Contacts`` setting can also be enabled or disabled at runtime by setting it in the AGX Simulation object: .. figure:: images/debug_rendering/settings_draw_shape_contacts_bp.jpg :alt: Enabling the Draw Shape Contacts setting at runtime. :target: _images/settings_draw_shape_contacts_bp.jpg Enabling the Draw Shape Contacts setting at runtime. .. note:: The contact point rendering is mainly a debugging and inspection tool and is not avaiable in built applications built with ``Shipping`` configuration. ``Draw Shape Contacts`` is computationally intensive, meaning it should be turned off whenever performance is important. .. _remote-debugging-label: *************** Remote Debugger *************** .. note:: Remote Debugger requires a separate installation of AGX Dynamics, since it requires ``AGXViewer``. Remote debugging is a way to let an instance of ``AGXViewer``, the default viewer of AGX Dynamics, connect to a Simulation running in |AGXUnreal| and display its render information. To enable Remote debugging, select ``Edit > Project Settings... > Plugins > AGX Dynamics``, and under the ``Debug`` category, set the ``Debugging Mode`` to ``Remote Debugger``: .. figure:: images/debug_rendering/settings_remote_debugging.jpg :alt: Enabling the Remote Debugger setting. :target: _images/settings_remote_debugging.jpg Enabling the Remote Debugger setting. From there, the port number can also be changed, as can be seen in the image above. To connect to the Simulation running in |AGXUnreal|, start ``AGXViewer`` with the following command: .. code-block:: agxViewer -p --connect localhost:```` Where ```` should be replaced by the port number set in the Project Settings.