Documentation: Missing example of Bullet Physics ... Code!

Hi again, I was watching documentation of panda in my free time and I see that C++ paragraph has a lot of “TODO”, “FIXME” and “UNAPPLICABLE” tags, so I decided to give a little help to new C++ Panda3D programers, hope that can be uploaded to Panda’s manual. My first contribution is a simple Bullet Physics Example.

:arrow_right: Source code can be find here: megaupload.com/?d=U6WCB22A (:roll: Don’t know any other way, maybe post whole code after.) I translate Python sources to C sintax with some C stuff.

:arrow_right: Compiling and Linking.

NOTE: Not problematic using Ubuntu 11.10 @ Dell Vostro 1520, If you can compile it, post specs too please :smiley:.

First, download BulletPhysics SDK on sources or binaries: bulletphysics.org/mediawiki-1.5. … /Main_Page).

Second, locate libraries and included files, normally ‘/usr/local/include/bullet’ on Linux distros, ‘pkg-config bullet --libs’ and ‘pkg-config bullet --cflags’ may work.

Finally, compile and linking it’s cool, just follow CXX File manual’s paragraph and add -Iyour_include_bullet_folder and -llibs (-lBulletSoftBody -lBulletDynamics -lBulletCollision -lLinearMath).

In my case is compiled with (Netbeans 7.0.1):

g++    -c -g -I/usr/include/python2.7 -I/usr/include/panda3d -I/usr/local/include/bullet -MMD -MP -MF build/Debug/GNU-Linux-x86/bulletPhysicsExample.o.d -o build/Debug/GNU-Linux-x86/bulletPhysicsExample.o bulletPhysicsExample.cpp

g++     -o dist/Debug/GNU-Linux-x86/pandaai_tests build/Debug/GNU-Linux-x86/bulletPhysicsExample.o -L/usr/lib/panda3d -L/usr/local/lib -lp3direct -lp3dtool -lp3dtoolconfig -lp3fmod_audio -lp3framework -lp3glstuff -lp3heapq -lp3openal_audio -lp3ptloader -lp3pystub -lp3vision -lpanda -lpandaai -lpandabullet -lpandaegg -lpandaexpress -lpandafx -lpandagl -lpandagles -lpandagles2 -lpandamesa -lpandaode -lpandaphysics -lpandaskel -ltinydisplay -lBulletCollision -lBulletDynamics -lBulletMultiThreaded -lBulletSoftBody -lBulletSoftBodySolvers_CPU -lBulletSoftBodySolvers_OpenCL_Mini -lLinearMath -lMiniCL

:arrow_right: Licensing. Bullet Physics has a BSD-like licence … enjoy your freedom 8).

:arrow_right: Testing machine: package panda3d1.8, Ubuntu 11.10 @ Dell Vostro 1520, probable issues: I use «include “panda3d/xxxxx.h”», so you must add parent folder if you have include -Iwherever/panda3d/.

Martínez Mendoza Carlos Edmundo, Merry xmas and happy new Year. Greetings from Mexico, good coding and sorry for my bad english.

Thank you very much! We appreciate improvements to the documentation, especially the C++ documentation which has always been a little weak.

Would you like to add your new text and examples to the Manual? You can edit the manual directly, using a login as described on this thread.

David

I’ll do :smiley: