Panda3D and physics

I have tried to look around to find some physics engine that works with panda, there are a few examples but everything is outdated that Ive found. What Im trying to do is to have a car drive trough a map.

Is there anyone that can direct me to a page that has a tutorial how to set it up and it actually is up to date and works.

have you tried newton? I do not know if it works with panda but i think its written in c++ again not sure but just google search it

1.5.3 has ODE integrated into it but early tests by Hypno’s says its a bit beta-ish right now. Also you would have to grab the unofficial 1.5.3 build from here.

I personally use Newton + Ctypes (native in python 2.5).
It allows me to make direct call to the newton.dll from panda3d.

You loose a bit in performance but i won’t do a wrapper until Archimedea is out officially (Archimedea is the new Newton version which is really a must)…

Now in term of performance, on my work laptop (3 years old), i get a steady 85fps with 20 boxes bouncing on the racing circuits you get in the free art download section of Panda3d

Manakel, how do you use ctypes? I tried many times, but failed. Can you, please, provide some examples how to use it?

Hello,

Please keep in mind that using ctypes does not look as nice as a python wrapper because you call exactly the same functions that you would call from a C Program (nice thing: you can use the help from the c api directly )

This said, i’ll review my code this weekend to make an explicit sample with panda 1.5.2
From newton i use only today

  • rigidBody with User Data, ForceAndTorqueCallBack , TransformCallBack
  • TreeCollision with TreeCollisionCallBack
  • Collision Materials (still a bit unpolished)

I plan to use Joint and Vehicle next month (my summer hollidays YEAH!)

Thanks guys for the answers. Yes Ive looked at Newton and it looks like one of the better once out there. Ive seen and tested it with other Graphics engines and really like it.

However, I have not been able to integrate it with panda. Im glad to see that they are integrated it into the new version of panda.

I am very new to game programming. So setting it up so it links and compiles properly is where Im having my issues. Since most wrappers, examples and tutorials are for older versions, Im having a hard time translating it in to the new versions. Im glad that you are updating your code, Manakel

I your going to use c-Types, you might want to look into PAL, which is a wrapper that supports lots of different physics engine under a single api. You have to compile it though…

adrianboeing.com/pal/index.html

There are existing wrappers around for Newton, JBSim, PhysX, Panda3D’s own Physics Engine and Panda3D has even ODE integrated. If you’re afraid to use something unstable, I don’t think using CTypes would give you anything more stable than what’s already there. Am I wrong?

Basically using a wrapper and using ctypes are 2 different path.
Using ctypes is a valid choice in a few restricted situations
a) you using a C library
and
b)either your library is moving fast (ie you would need to update / recompile your wrapper every weeks …)
c)either your engine is moving fast

Using ctypes can be as stable as a wrapper, but you deal with the complexity at Python level instead of C/CPP wrapper level.

Note that PAL would be interresting but it still miss the python acces

Thank you guys, this is helping.

Now is there a place where I can get information on ctypes that is uptodate and works with the current versions of Panda and Newton?

so let me get this straight…panda can use python wrappers to interact with newton or is newton already inside panda you just need to call it and apply it to models?

:wink:

To summarize the existing choices of physics with Panda3D

a) inside panda “core” there is an ODE Wrapper since 1.5.2 (still beta)
b) you can manually use PyODE with Panda
c) there is some community contributed wrapper to other physics engine
c1) Newton
c2) JBSim
c3) PhysX,
[Note: you need to check if this wrapper are compiled with latest Panda version ]
d) there is the quick and dirty solution i use, ctypes+Newton.
[Note: it’s really means calling directly “C” Functions of Newton from your panda code!]

Most Wrapper (if they are up to date with current panda version) are easier to use than solution d

Uh, a few remarks:

  • Panda3D also has its builtin physics engine aside from ODE. The builtin physics system is a good fit in simple cases of force attaching etc.
  • ODE was integrated since 1.5.3, not 1.5.2. Plus, the things _Hypnos choked on and found ‘beta’ are fixed at CVS already. If you use it right, it’s not likely to crash, and if it does, it is only likely to get fixed in new releases. :slight_smile:
  • If a wrapper is not up-to-date with your panda3d version, it is really easy to compile a wrapper. You just need to overcome your Compile-O-Phobia for a split second. :slight_smile: (On windows, it needs a little more than a split second, but most of the time its worth it.)

Since c1 to c3 is basically by me: none of these three is still actively maintained.

I am working on a new PhysX project now. Not a native Python wrapper like the first one. I am using Panda3D interrogate for the Python bindings now. So it is more a Panda-addon than a wrapper, and it will be for Windows and Linux.

My aim is to provide a way more simple physics system while being stable at the same time. The current plan is to release to a first release at the end of my summer holiday, around end of next month (one or two weeks without Enterprise Java Beans :slight_smile:

enn0x

I fear i’ll never get rid of my compilo phobia … on windows…

Last time i had to compile a damm thing for here, i was bound to use the damm MSVisual 200x

So i had to grab the free thing on MS site

  1. genuine Windows check
  2. download the installation file
  3. update .Net to latest version
  4. reboot
  5. let the bloody installation file download about 400 megs of stuff very very slowly (much more slowly that a direct tp download) => 1h30
  6. download the "xx addon " because i’m working on XP SP2 with a “non 2008” compiler requirement
    7)another 200 megs of installation files
    8) install everything (wow 1,9 Gig already for a damm C++ compiler??)
  7. reboot for safety (and because it was already asked twice by MS)
  8. configure everything
    (because even if IDE & Addons come from the same editor, they sure don’t have a hint on how to talk together so yeah, let’s write some environment’s variables, run a few .bat, edit 2 configuation files etc…)
  9. open the freaky stuff
  10. perform an online registration of some sort
    13 configure the file associations (no i don’t want txt.bas,vbs,xml,c,cpp,h etc… to be open with this huge beast by default)
  11. check all the usual compiler options (linkage etc…)
  12. wonder why, for god sake, when i want to compile a damm project i need to have 4 panels with 3 subpanels and some Browser stuff on MS Announcements , etc…
  13. wonder why, in this 12 subwindows , there is none that is usefull for the task at hand (so i need to use menu, open dialog box and so …)
  14. find a way to register new files extensions to compile (like hpp;.i etc…)
  15. launch the compilation, sleep around 19 minutes…

Then simply

a) uninstall the ide (1,9 gigs)
b) uninstall the addons (400 megs)
c) uninstall the installation files (800 megs)
d) unregister from the dam mail spamming MS
e) reboot the computer for safety reasons
f) uninstall Internet explorer again (because MS Visual is not able to use the default Internet Browser if it’s not IE )

Really no reason to be phobic when you need to compile C++ with a specific MS visual 2xxx version on windows XP…
[/list]

Note: i was not compiling Panda3D :wink:

But this can be compared to compiling the Irrlicht Engine with devcpp.
a) download devcpp zip file (<3min)
b) unzip on your usb key (<2min)
c) open devcpp
d) configure (1 panel with 4 tabs )
e) compile

Total size of the tool : 30meg
Environnemnt variables, configuration file : 0
(or 1 option if you want to launch from anywhere from your usb key)

No comment !!!