Simple CollisionNode problem

Hi everyone,

I’ve got a 64bit Linux (Fedora) machine; compiled panda via source, and IDE is eclipse.

The intro tutorials work great (code-completion, documentation works fine), but I’m having troubling understanding why classes namely CollisionNode, CollisionRay, CollisionHandler do not import.

I’m assuming it is because panda is built using static C/C++ libs?

I would really be appreciative for any advice.
Thanks,
p.

You mean, import into Python? It’s a good question; I never heard of problems importing the collision system objects before.

Whatever the problem is, I can’t imagine it’s due to Panda being built with static libs. First, unless you go out of your way to build Panda statically, it will be built with dynamic libs. Second, if you did go out of your way and successfully built Panda with static libs, then you wouldn’t be able to use any of the Panda objects within Python, not just the collision system. Unless by “static libs” you means something other than what I think you mean?

How did you build Panda, were you using makepanda or ppremake? If you run “nm libpanda.so | grep CollisionNode”, do you see these symbols being exported? Can you “import libpanda” and then inspect “libpanda.CollisionNode”?

David

Hi drwr,
Thanks alot for the prompt reply.

Panda (1.7.2) was built using the makepanda.py command (and not ppmake). I added some custom flags to makepanda.py, but they’ve got to do with video-card, threads, etc.

‘import libpanda’ (assuming you mean libpanda pointing to panda3d/built/lib/libpanda.so) does not work (as it isn’t a .py script), but ‘grep CollisionNode’ yielded numerous results.
To be honest, I’ve had this problem (collision import error) since 1.7.0 and tried it on win, mac and linux. Whenever I do:
“from pandac.PandaModules import CollisionNode”, I get an import-related error.

My ultimate goal is to solve how to import collision-related classes (such as CollisionNode, CollisionHandler, etc) and utilize such objects like any other panda class.

Hopefully the above has provided info.
Thanks once again,

Actually, “import libpanda” should successfully import libpanda.so. Although it’s not a .py file, it is in fact a compiled Python module, and Python should be able to import it as such. If that module can’t be imported, you have bigger problems than collisions.

Which leads to the next question: can you, in fact, import anything at all from pandac.PandaModules? It sounds like your problems aren’t related to the collision system at all.

It’s a common problem when building your own Panda to fail to set up the environment correctly to run that version of Panda successfully. You have to have the libpanda.so and related built modules on your LD_LIBRARY_PATH as well as on your PYTHONPATH. And, the version of Python that is running has to be the same version that you built with.

David

Thanks once again for your help. I really appreciate it.

I’ve looked around hopefully going down the right path.
I added an ‘LD_LIBRARY_PATH’ entry mapping to the panda/built/lib folder.
PYTHONPATH also mapped to the same folder (mentioned in a prior post).
Lastly, I am also using ‘ppython’ rather than the regular Python ‘python’ interpreter.

Unfortunately reloading eclipse and adding ppython to the interpreter list yields no new results as far as seeing CollisionNode, CollisionHandler, or any related class.

Is there an implicit step not mentioned in the doc?

I think it’s best to try to figure out precisely what’s going wrong first, then we can figure out what you need to do to fix it.

First:

(1) You keep talking about CollisionNode and related classes, but I think it doesn’t have anything to do with collisions. Can you import any symbol from pandac.PandaModules? Say, can you import NodePath? More to the point, can you import direct.directbase.DirectStart and do you see a window when you do this?

(2) Let’s isolate this to an IDE vs. Python issue. Does it work when you just run python from the command line? If so, then we need to figure out what your IDE is doing to the environment. If not, then we need to figure out what’s wrong with your environment in the first place.

David