Panda PhysX


Actually, it won’t even build unless NX64 is defined, because of a problem with data types.


Hi enn0x,
I’m trying to launch panda Physx samples on Kubuntu GNU/Linux but it doesn’t work.
I’m using the latest Panda3d stable version for Ubuntu and Physx 2.8.1.
Could you post me some information regarding the correct configuration on linux?
Thanks in advance


Sorry, Linux is not my strong side. I am currently in the process of setting up virtual Ubuntu Karmic machines (32/64bit) for testing, but it will take time.

By the way: “it doesn’t work” it too prune to allow any help at all.


Yes you are right, so here some details:

  1. Panda Version: 1.7.0
  2. Python Version: 2.6.5
  3. OS: Kubuntu Lucid (10.04)
  4. Physx system software: 2.8.1

I’m trying to launch the Panda3d/Physx samples and I get the following error:

Traceback (most recent call last):
  File ".../", line 12, in <module>
    from panda3d.physx import PhysxManager
  File "/usr/share/panda3d/direct/ffi/", line 145, in __getattr__
    mod = self.__manager__.libimport(self.__library__)
  File "/usr/share/panda3d/direct/ffi/", line 122, in libimport
    raise ImportError, message
ImportError: DLL loader cannot find libpandaphysx.


Ok, seems like importing libpandaphysx fails, for whatever reason. Can you check a few things:

1.) Is the PhysX runtime installed correctly and are the PhysX samples that come with the PhysX SDK working? I am asking because there is no “PhysX system software” for Linux, only for Windows. Also I think you have to call ldconfig manually after installing the .deb packages. Can ypu please tell us what .deb packages you exactly installed?

2.) Do the Panda3D binaries you installed contain libpandaphysx? If so, please make sure it is there and tell us the full path of this file. I am asking bacause I think the default Panda3D binaries are not compiled with PhysX support.


Yes I installed a set of .deb packages downloaded from this url:
and followed the instructions until the creation of the 3 symbolic links.
All demo are working properly, by the way I didn’t called ldconfig after installing the .deb packages. Which command should I use exactly?

This might be a problem because there isn’t a libpandaphysx file, instead I’ve found these two files in the Panda3d libraries folder:



If the PhysX demos run fine there is no need to call ldconfig yourself.

These libs are Panda3D’s built-in physics system. They are not related to ODE or PhysX. So you have installed Panda3D binaries without PhysX support. You have to compile Panda3D yourself (using --use-physx option for makepanda), or maybe ask rdb if he knows a download for Panda3D binaries with PhysX support.


All right, it seems that I am close to the solution, however who is rdb? how can I contact him?


Hello. :slight_smile:

I believe the buildbot build ships with PhysX support, but it’s currently only available for Ubuntu Karmic, sorry— I’m afraid you’ll have to compile Panda3D yourself.


Hi!! :wink:
that’s not a problem! could you give me some instructions about this matter. Should I compile it with a specific flag for physx, as enn0x wrote me?..or the “–everything” flag is enough?

PS: I’ll post all the steps once I’ll have the samples working on linux.


As long as you have the SDK installed, makepanda should automatically detect it and compile with support for it.



I am making some progress. I can compile on 32bit and 64bit Linux now, and with current Panda3D CVS and PhysX 2.8.3 I can verify the same segfaults that you reported. This is, I get them on 64bit AND 32bit, so this is not a problem specific to 64bit.

Since this very code works fine for the 2.8.1 Linux SDKs there must have been something changed on the PhysX SDK side. I didn’t see anything mentioned in the PhysX documentation though. Also, the PhysX Linux samples come only in binary form (no source code and no build files) on Linux, so I have virtually no chance to find out what is done differently in these samples.

Please remember that the PhysX 2.8.3 SDK’s you downloaded are BETA, and even after some month there is no public release, so it might be that there are still bugs and strange effects in 2.8.3 Linux SDKs.

On Windows I have already moved to the (released, not beta!) 2.8.4 SDKs, which make things much easier with regard to distribution (there is no longer a requirement for a PhysX system software).


Here is a tiny sample for PhysX, pure C++ and nothing to do with Panda3D. It compiles for the new 2.8.3 SDK, and it also reproduces the segfault within fetchResults. There is nothing wrong with the code.

Whitelynx, can you verify this please? Also, since you are the only one who officially downloaded the closed 2.8.3 beta SDK, can you perhaps report this to NVIDIA as a possible bug?

// g++ -DNX_DISABLE_FLUIDS -DCORELIB -DNX32 -DLINUX -I/usr/include/PhysX/v2.8.3/SDKs/Physics/include -I"" -I/usr/include/PhysX/v2.8.3/LowLevel/API/include -I/usr/include/PhysX/v2.8.3/SDKs/Cooking/include -I/usr/include/PhysX/v2.8.3/SDKs/PhysXLoader/include -I/usr/include/PhysX/v2.8.3/LowLevel/hlcommon/include -I/usr/include/PhysX/v2.8.3/SDKs/Foundation/include -I/usr/include/PhysX/v2.8.3/SDKs/NxCharacter/include -O3 -Wall -c -fmessage-length=0 -m32 -o"foo.o" "./foo.cpp"
// g++ -L/usr/lib32 -m32 -o"foo"  ./foo.o -lPhysXLoader -ldl -lpthread

#include <iostream>
#include "NxPhysics.h"

using std::cout;
using std::endl;

static NxPhysicsSDK* gPhysicsSDK = NULL;
static NxScene* gScene = NULL;
static NxActor* gPlane = NULL;

int main(int argc, char** argv) {

  // Init SDK
  NxPhysicsSDKDesc desc;
  NxSDKCreateError errorCode = NXCE_NO_ERROR;

  gPhysicsSDK = NxCreatePhysicsSDK(NX_PHYSICS_SDK_VERSION, NULL, NULL, desc, &errorCode);
  gPhysicsSDK->setParameter(NX_SKIN_WIDTH, 0.05f);

  // Create scene
  NxSceneDesc sceneDesc;

  sceneDesc.gravity = NxVec3(0.0f, -9.81f, 0.0f);
  gScene = gPhysicsSDK->createScene(sceneDesc);

  // Create ground plane
  NxPlaneShapeDesc planeDesc;
  NxActorDesc actorDesc;

  gPlane = gScene->createActor(actorDesc);

  // Main loop
  for (int i=0; i<10; i++) {
    cout << " 1.." << endl;
    cout << "   2.." << endl;
    gScene->fetchResults(NX_RIGID_BODY_FINISHED, true);
    cout << "     3.." << endl;


I tried compiling the 64-bits version of that (replacing NX32 by NX64, removing -m32 and the lib32 reference in the commands), and it segfaulted at fetchResults.


Sorry, I should have added that I tried 64bit too, with the same compiler options you have used, and got the same result.

My conclusion is that - since I can’t see any obvious mistake in this short sample - that Linux PhysX SDK 2.8.3 requires some new or modified defines. I try to dig up some info here…


I’m trying to compile the latest CVS on Windows, for the first time :slight_smile:, and am getting the following error (I have both VS C++ 2008 Express and VS 2005 installed with Win SDK 6.1 and PhysX SDK 2.8.1):

Any ideas?

I found the following in the physxEnums.h file:

And lower down at line 388:

Shouldn’t the first one be “#ifdef PHYSX281”? Tried it but it made no difference.


Ahhh, my fault. These flags are only defined in SDKs later than 2.8.1. So the preprocessor instruction in the lower half of physxEnums.h should be:

#ifndef PHYSX281
    P_fast_massive_bp_volume_deletion       = NX_FAST_MASSIVE_BP_VOLUME_DELETION,
    P_legacy_joint_drive                    = NX_LEGACY_JOINT_DRIVE,

I also should have mentioned that we moved to newer versions of the PhysX SDK on Windows:
Windows: PhysX
Linux: PhysX 2.8.1

I recommend compiling on Windows 32bit using the SDK. Windows 64bit is still untested. It’s only Linux where we need to work with the obsolete 2.8.1 SDK.

Please notice that you no longer need to distribute a PhysX System Software from 2.8.4 on. You can, but you don’t have to if you distribute just a few /dlls from the 2.8.4 SDK. The SDK documentation has a chapter about the new way of distributing.


Compiled, thanks.

When running, however, I got “<32bit>” printed to the console all the time. Found the following in physxScene.cxx:

#ifdef NX64
  cout << "<64bit>";
  cout << "<32bit>";

I guess it was for debugging purposes? Just commented it out…


Yes, right, this has been for debugging purposes. I remove it in CVS too. Thanks for reporting.


There is a MacOSX version of the NVIDIA PhysX SDK by now. Version is 2.8.4, wich is the same as Windows.

I don’t have a Mac, so I can’t give it a try. But if someone is interested in attempting I would offer help with compiler errors. I don’t expect the Panda3D code to compile out of the box on Mac, but it should be only minor modifications.