Game Development Community

T3D 1.1 Crash on exit (PhysX) (with solution)

by Rex Hiebert · in Torque 3D Professional · 06/16/2011 (3:17 pm) · 8 replies

I have a scene that only has static objects in it. Whenever I exit it crashes with the following error:

Orphan NxActor - '(null)'!
Orphan NxActor - '(null)'!
Orphan NxActor - '(null)'!
c:torquetorque 3d pro 1.1enginesourcet3dphysicsphysxpxworld.cpp(230) : Fatal - PhysXWorld::_destroy() - Some actors and/or joints were not released!


I can add PhysX objects to the scene and they work as expected. But it always crashes on exit.

EDIT:
Hmmm... only seems to happen if I close the window by hitting the "x". Exiting where i can have the script destroy the physics world seems to be ok.

#1
06/16/2011 (3:49 pm)
I'm not sure how you're building the package or if you're building the package but Pacific Demo doesn't do this..perhaps you want to use that as your base ?

Also; this is noteworthy..
certain collada exporters will mangle names if they contain spaces and or Capital letters in the name ..thus...replacing any of those meshnames with "null"..& it can get messy fast.
#2
06/16/2011 (4:38 pm)
Here's how I started...

Create a new project using a modified Empty template that includes PhysX but removes the web plugin.

Using PhysX 2.8.4.5

It would crash on exit but the pacific demo wouldn't.

Here's the solution....
in the file scripts/client/serverConnection.cs of the Empty Template you have:
function disconnect()
{
   // We need to stop the client side simulation
   // else physics resources will not cleanup properly.
   physicsStopSimulation( "client" );

   disconnectedCleanup();
   
   // Delete the connection if it's still there.
   if (isObject(ServerConnection))
      ServerConnection.delete();


   // Call destroyServer in case we're hosting
   destroyServer();
}

The same file in the Pacific demo has the disconnectedCleaup() call AFTER the ServerConnection.delete()like this...

function disconnect()
{
   // We need to stop the client side simulation
   // else physics resources will not cleanup properly.
   physicsStopSimulation( "client" );
   
   // Delete the connection if it's still there.
   if (isObject(ServerConnection))
      ServerConnection.delete();
   disconnectedCleanup();

   // Call destroyServer in case we're hosting
   destroyServer();
}

No more crashing!
#3
06/16/2011 (5:05 pm)
I love it when people know how to archive info. u teh man!
#4
06/17/2011 (1:04 am)
Rex, you are my hero.

thank you so much
#5
06/17/2011 (1:21 am)
double post, cause the site went down, go figure...
#6
08/09/2011 (10:02 am)
Thanks Rex, you are the man!!!
#7
10/25/2011 (3:21 am)
I am getting the same problem using the Full Template but moving the disconnectedCleanup(); line doesn't seem to fix it.

It crashes if escape is used or the 'X' is clicked.

Are there any other places that need to be changed?
#8
10/25/2011 (8:07 am)
Not that I recall but I haven't spent a lot of time with it since then. Most of my time is on a project created in 1.0.1 which I don't have time to port to 1.1.