Panda PhysX


So I should better use ODE instead of waiting for a linux 64bit version of physx? Or is there a approximate date of such a release?



If the above instructions on how to compile Panda3d + PhysX in 64bit Linux won’t help you: Yes, try using ODE. For any Linux releases of PhysX: I am not aware of any release dates posted by NVIDIA.


You can follow this thread, if you would like to use PhysX:


Hay enn0x,

I’m trying to release() a PhysxCapsuleController but I’m getting an Assertion right when its being called.

Any ideas why?

BTW, this same code worked with the wrapper, I recently converted to 1.7.0 with the new Physx.


I need a few more infos. First, which assertion you get, and second what you are doing with the controller and maybe the atached actor on the Python side.


Okay, here’s the message:

The first assertion shows up and a ‘Close the program’ dialogue appears. When I click on Close, the second assertion comes up.

I do have a task running which uses the controller, but I’ve checked that it gets removed with taskMgr.remove(“taskname”) just before releasing the controller.

I added the following to the character sample at the end of the setup() function and still got the same assertion when trying to reset:

    self.accept('r', self.reset)

  def reset(self):

  def cleanup(self):


This helps a lot. Line 73 of file physxController.cxx is the first line of the method PhysxController.getActor(). This means that not the release() method fires the assert, but the getActor() method.

Seems like I call getActor() after destroying the controller pointer. I try to fix this until tomorrow. Thanks for reporting.


Fixed in current CVS.


Seems like NVIDIA is finally resurrecting the Linux ports of the PhysX SDK (32bit and 64bit). Beta versions of the SDK are already available if registering for Beta testing.


Yay! That’s very good news! I’ll try them on the buildbots as soon as I get time.


I have not yet registered for beta testing, but will do so next week.

NVIDIA has announced a Mac SDK too, besides the Linux 32/64bit. I don’t know what “closed beta” means, but there is no download so far. Maybe the Mac SDK won’t be public, like Wii and XBox.


Could you makea guide on how to cook an object from blender to nxb? or maybe egg to nxb?

Oh nevermind, just found it.

it is in in samples


Please pay attention to this line:

for geomNP in modelNP.findAllMatches('**/+GeomNode'):

This means the script searches for ALL geom nodes, and feed them to one single triangle mesh. Depending on what your egg files look like this might be a bad idea. You might want to split it up into smaller chunks, or filter the geom nodes (geometry tagged as collision geom withing the egg file e.g.).


Oh, thank you for info, i have some other things that i do not know how to handle, i have read most of this thread and not quite sure how to go about this…

1.A I want collision solids to follow bones(joints).
Mostly it would be tubes-spheres for character, eventually box (for weapons).
As far as i could gather this has to be done manually(panda task), would cython help with that?
With panda’s internal collision system this is done automatically, just parent collision sollid to bone, and offset it as needed.
1.B Could you write some basic sample on how to do it?

  1. Ragdolls, i would like character to be doll after he dies, and fall on ground a bit more realistically. From what i could tell, i have to release all animations, and that is not problem(i hope), but is there way to constrain joint’s movement(angle mostly)?

  2. Are you still interested in writing manual? I think more people would use physx if it has something about it in manual, it would look more official.


In your case it is not the physics engine which controls the movement of the objects, but the animations.
This is what I would try: create one PhysxActor for each bone, and give it a shape, for example a capsule or box. Make the actor kinematic. Each frame read the bone transform and set this transform on the kinematic actor. PhysxActor::moveGlobalPos/Mat/Hpr would be the right methods for setting the transforms. You might have to disable collisions between the “bone” actors.

No, sorry, see 3.

Ragdoll is the inverse situation. Here not the animation/bone controls the physics object, but the physics object controls the bones. You will have to completely reorganize the way your player is setup. Perhaps it is best to discard it and setup a new object.
I suggest having one actor per bone again, but this time not kinematic but dynamic, and the bone NP has to be attached to the dynamic (physx) actor. I think you have to expose the (panda actor) joints in order to be able to control then individually. Finally you have to connect the (physx) actors with (physx) joints. PhysxSphericalJoint should work. It also might be good to set limits on how far the joints can swing or twist (setSwingLimit, setTwistLimitLow/High, setSwingSpring, setTwistSpring).

Writing tutorials or manuals requires lots of time, and time is something I don’t have currently. I have been working on a Bullet module similar to the PhysX module for the last few month, my wife is giving birth to our first child in less than two weeks, and I am trying to get together the right concepts for the next level of physics modules for Panda3D (more tight integration, smaller codebase, more easy to use, but also less freedom because of the smaller API). But I should stop lamenting and do some work again…


Thank you, and congratulations on baby :slight_smile:. Have a lots of fun with him/her!


Morgul got into the beta, and we have all the beta SDK downloads; I’ll PM you links. If anyone else in the thread wants to help out debugging this, PM me and I’ll send you links as well.

Here’s the instructions I’ve written for building Panda with support for 64-bit PhysX:

= Panda3D + PhysX on 64-bit Linux =

== Building ==

To build Panda3D with PhysX support on 64-bit Linux, first you need to install the latest 64-bit Linux PhysX SDK. (currently only available through NVidia's beta tester program)

Next, apply the accompanying panda3d-physx-linux64.patch to the Panda3D source tree:

	patch -p 1 < ../panda3d-physx-linux64.patch	

Build using makepanda, setting one specific CFLAG externally:

	CFLAGS='-DNX64' makepanda/

Finally, install Panda3D:

	sudo python makepanda/

== Testing ==

You can then check to make sure the Panda3D PhysX library exists:

	ls /usr/local/lib64/panda3d/

Then, run one of the PhysX samples to test it:

	ppython panda3d-physx-samples/

And here’s the accompanying patch:

diff -r -u panda3d-cvs-original/makepanda/ panda3d-cvs/makepanda/
--- panda3d-cvs-original/makepanda/	2010-09-02 05:55:03.000000000 -0500
+++ panda3d-cvs/makepanda/	2010-09-15 00:35:34.767806577 -0500
@@ -1478,7 +1478,7 @@
                 if folder.endswith("NVIDIA PhysX SDK\\%s\\SDKs\" % key):
                     SDK["PHYSX"] = folder
                     SDK["PHYSXVERSION"] = ver
-        elif (sys.platform.startswith("linux") and platform.architecture()[0] != "64bit"):
+        elif (sys.platform.startswith("linux")):
             incpath = "/usr/include/PhysX/%s/SDKs" % key
             libpath = "/usr/lib/PhysX/%s" % key
             if (os.path.isdir(incpath) and os.path.isdir(libpath)):

So far, I’ve gotten everything to the point where it builds and the normal samples all work, but I consistently get a segfault when running the PhysX samples:

(gdb) r
Starting program: /usr/bin/ppython
[Thread debugging using libthread_db enabled]
DirectStart: Starting the game.
Known pipe types:
(all display modules loaded.)
[New Thread 0x7fffd9f50710 (LWP 9556)]
[New Thread 0x7fffd974f710 (LWP 9557)]
[New Thread 0x7fffd8f4e710 (LWP 9558)]
[Thread 0x7fffd974f710 (LWP 9557) exited]
[Thread 0x7fffd8f4e710 (LWP 9558) exited]
[New Thread 0x7fffd8f4e710 (LWP 9567)]
[New Thread 0x7fffd974f710 (LWP 9569)]
a[True]= 1
b[True] 1
c[True]= 1
d[True]= 1
e[True]= 1

Program received signal SIGSEGV, Segmentation fault.
0x00007fffd3a66267 in ?? () from /usr/lib/PhysX/v2.8.3/
(gdb) bt full
#0  0x00007fffd3a66267 in ?? () from /usr/lib/PhysX/v2.8.3/
No symbol table info available.
#1  0x00007fffd831d0d7 in PhysxScene::fetch_results() () from /usr/local/lib64/panda3d/
No symbol table info available.
#2  0x00007fffd835a869 in Dtool_PhysxScene_fetch_results_1196(_object*, _object*, _object*) () from /usr/local/lib64/panda3d/
No symbol table info available.
#3  0x00007ffff7b15bbf in PyEval_EvalFrameEx () from /usr/lib/
No symbol table info available.
#4  0x00007ffff7b17570 in PyEval_EvalCodeEx () from /usr/lib/
No symbol table info available.
#5  0x00007ffff7aaa9cf in function_call () from /usr/lib/
No symbol table info available.
#6  0x00007ffff7a83893 in PyObject_Call () from /usr/lib/
No symbol table info available.
#7  0x00007ffff7a9644f in instancemethod_call () from /usr/lib/
No symbol table info available.
#8  0x00007ffff7a83893 in PyObject_Call () from /usr/lib/
No symbol table info available.
#9  0x00007ffff42fce3d in Thread::call_python_func(_object*, _object*) () from /usr/local/lib64/panda3d/
No symbol table info available.
#10 0x00007ffff4324b80 in PythonTask::do_python_task() () from /usr/local/lib64/panda3d/
No symbol table info available.
#11 0x00007ffff4319c8a in AsyncTask::unlock_and_do_task() () from /usr/local/lib64/panda3d/
No symbol table info available.
#12 0x00007ffff4326aa3 in AsyncTaskChain::service_one_task(AsyncTaskChain::AsyncTaskChainThread*) () from /usr/local/lib64/panda3d/
No symbol table info available.
#13 0x00007ffff432780d in AsyncTaskChain::do_poll() () from /usr/local/lib64/panda3d/
No symbol table info available.
#14 0x00007ffff4327989 in AsyncTaskManager::poll() () from /usr/local/lib64/panda3d/
No symbol table info available.
#15 0x00007ffff433a219 in Dtool_AsyncTaskManager_poll_121(_object*, _object*, _object*) () from /usr/local/lib64/panda3d/
No symbol table info available.
#16 0x00007ffff7b15bbf in PyEval_EvalFrameEx () from /usr/lib/
No symbol table info available.
#17 0x00007ffff7b16140 in PyEval_EvalFrameEx () from /usr/lib/
No symbol table info available.
#18 0x00007ffff7b17570 in PyEval_EvalCodeEx () from /usr/lib/
No symbol table info available.
#19 0x00007ffff7b15af5 in PyEval_EvalFrameEx () from /usr/lib/
No symbol table info available.
#20 0x00007ffff7b16140 in PyEval_EvalFrameEx () from /usr/lib/
No symbol table info available.
#21 0x00007ffff7b17570 in PyEval_EvalCodeEx () from /usr/lib/
No symbol table info available.
#22 0x00007ffff7b17642 in PyEval_EvalCode () from /usr/lib/
No symbol table info available.
#23 0x00007ffff7b3187c in run_mod () from /usr/lib/
No symbol table info available.
#24 0x00007ffff7b31950 in PyRun_FileExFlags () from /usr/lib/
No symbol table info available.
#25 0x00007ffff7b32dfc in PyRun_SimpleFileExFlags () from /usr/lib/
No symbol table info available.
#26 0x00007ffff7b3f25d in Py_Main () from /usr/lib/
No symbol table info available.
#27 0x00007ffff74e5c4d in __libc_start_main () from /lib/
No symbol table info available.
#28 0x0000000000400609 in _start ()
No symbol table info available.

Any ideas?


I managed to compile this using ppremake on my own machine, and committed the required changes to CVS. It’s supposed to compile out of the box on makepanda now, but I haven’t tested.

I can confirm that I get the same crash on 64-bits Linux, while the demos that were shipped with the SDK (even the cloth one) work fine.


Until I have a two virtual linux machines (32bit, 64bit) up and running: can you check if NX64 got defined?
I don’t know for sure if it should be set on 64bit linux or not.
What you could do is to set it explicitly to NX32 and see if the segfault is gone, then set it explicitly to NX64. Setting is done in physx_includes.h.


Yeah, I added code to do that in physx_includes.h.

You could try and see if the 32-bits Linux beta of 2.8.3 also shows the same problem- it may not be a problem with 64-bits, but just with this version.