Howto: Use PhysX Visual Debugger with Torque3D
by Andreas Johansen · in Torque 3D Professional · 05/13/2009 (10:37 am) · 4 replies
EDIT: Apparently GG had already thought about this and added two script functions for this: physXRemoteDebuggerConnect and physXRemoteDebuggerDisconnect. Use these from the console to connect to the remote debugger.
----
Nvidia has a neat little tool for debugging PhysX applications with. It's called "PhysX Visual Debugger" and can be found here: developer.nvidia.com/object/pvd_home.html
Using this tool you can get the PhysX scene visualized and inspect every objects in the scene. Read the help that comes with the application for instructions.
To be able to use it the application, or in this case T3D, must be set up to connect to a remote debugger (local in most cases). Here's how to do that, and a screenshot of it;
In pxWorld.cpp add this to the end of bool PxWorld::restartSDK( bool destroyOnly, PxWorld *clientWorld, PxWorld *serverWorld )
This sets up the connection against the remote debugger on "localhost" (your computer) and the default port (5425) for the Visual Debugger. You'll notice that I've added a query for a console var called "$PhysX::useRemoteDebugger". You need to add this somewhere in your scripts and set it to true to be able to connect to the debugger. I've added it to my C:/Torque/Torque 3D 2009 Beta 1/Demos/PhysX/game/core/main.cs script inside the onStart() function, but any place should work (as long as it's executed that is).
Once you have done these changes, rebuild the PhysX demo source and then start the PhysX Visual Debugger before starting the PhysX demo. In the Visual Debugger go to 'View'->'Up axis' and set it to 'Z+' to get the same coordinate space as T3D. Now start the PhysX demo and once you load up a mission the PhysX scene should start showing in the Visual Debugger :)
Finally, here's a screenie (not sure what's with the red line in the T3D scene):
andreasjohansen.com/img/t3d/physx_visualdebugger.jpg
----
Nvidia has a neat little tool for debugging PhysX applications with. It's called "PhysX Visual Debugger" and can be found here: developer.nvidia.com/object/pvd_home.html
Using this tool you can get the PhysX scene visualized and inspect every objects in the scene. Read the help that comes with the application for instructions.
To be able to use it the application, or in this case T3D, must be set up to connect to a remote debugger (local in most cases). Here's how to do that, and a screenshot of it;
In pxWorld.cpp add this to the end of bool PxWorld::restartSDK( bool destroyOnly, PxWorld *clientWorld, PxWorld *serverWorld )
#ifndef TORQUE_SHIPPING
bool useRemoteDebugger = Con::getBoolVariable("$PhysX::useRemoteDebugger", false);
#else
bool useRemoteDebugger = false;
#endif
if (useRemoteDebugger)
{
gPhysicsSDK->getFoundationSDK().getRemoteDebugger()->connect("localhost", 5425);
}This sets up the connection against the remote debugger on "localhost" (your computer) and the default port (5425) for the Visual Debugger. You'll notice that I've added a query for a console var called "$PhysX::useRemoteDebugger". You need to add this somewhere in your scripts and set it to true to be able to connect to the debugger. I've added it to my C:/Torque/Torque 3D 2009 Beta 1/Demos/PhysX/game/core/main.cs script inside the onStart() function, but any place should work (as long as it's executed that is).
// Uncomment useRemoteDebugger to connect to remote debugger $PhysX::useRemoteDebugger = true;
Once you have done these changes, rebuild the PhysX demo source and then start the PhysX Visual Debugger before starting the PhysX demo. In the Visual Debugger go to 'View'->'Up axis' and set it to 'Z+' to get the same coordinate space as T3D. Now start the PhysX demo and once you load up a mission the PhysX scene should start showing in the Visual Debugger :)
Finally, here's a screenie (not sure what's with the red line in the T3D scene):
andreasjohansen.com/img/t3d/physx_visualdebugger.jpg
#2
At the bottom of pxWorld.cpp are two console functions:
physXRemoteDebuggerConnect and physXRemoteDebuggerDisconnect.
It works like this...
Run the t3d PhyXDemo project.
Run the remote debugger.
Use the console functions.
05/13/2009 (11:18 am)
Actually this is already implemented, though a bit differently.At the bottom of pxWorld.cpp are two console functions:
physXRemoteDebuggerConnect and physXRemoteDebuggerDisconnect.
It works like this...
Run the t3d PhyXDemo project.
Run the remote debugger.
Use the console functions.
#3
05/13/2009 (11:20 am)
Doh, didn't see that. Thanks :)
#4
05/14/2009 (10:29 am)
BTW guys, when connecting the Remote Debugger via the physXRemoteDebuggerConnect function, if it pops up any sort of dialog giving you a warning about something, you can safely just hit OK a couple of times and it will still work out.
Torque Owner deepscratch
DeepScratchStudios