Bullet – physics installation for OpenSim

Introduction to Bullet:

Bullet is the modern physics engine that the OpenSim dev team are heading towards during the version 8.x builds of OpenSim. Although it’s only bullet version 2.x it provided a more robust collision detection for regions to make them feel more like the Second Life regions. It is uncertain of Bullet development will continue with the introduction of AviNations code-merge of their updated ODE Physics which allow for better prim sitting and vehicle crossing from region to region. Currently, although you can follow all of the steps and compile bullet onto your Arm based Pi. Bullet simple does not run and you must run Bullet in XNA mode which isn’t optimal.

How to install bullet physics onto your OpenSim metaverse environment:

modify your  OpenSim.ini as follows at around line 240:

    ;; Choose one of the physics engines below     ;# {physics} {} {Select physics engine} {BulletSim OpenDynamicsEngine basicphysics POS} BulletSim     ;; OpenDynamicsEngine was the previous default physics engine in OpenSimulator and before.     ;; It continues to provide a workable physics implementation.  ODE does not currently support varregions.     ;; basicphysics effectively does not model physics at all, making all objects phantom.     ;; Default is BulletSim     ; physics = OpenDynamicsEngine     physics = BulletSim     ; physics = basicphysics     ; physics = POS

Errors of BulletSIM:

FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: BulletSim errors!

As of OpenSim version 0.8.x and beyond the new physics standard is now “Bullet” and ODE or “OpenDynamicsEngine” physics has been demoted to a backup.

Installing BulletXNA (Bullet Managed Mode):

Open your /bin/OpenSim.ini file and add this to the bottom of your file.

[BulletSim]     UseSeparatePhysicsThread = true     TerrainImplementation=0     BulletEngine = "bulletxna"

What this will do is you are telling the Mono engine to handle Bullet physics via XNA instead of relying on the linux libraries to handle the data back and forth. The results for prims and avatars is very good! However, users may encounter issues with mesh objects especially if the collision data is either lacking or not a perfect hull such as a ‘box’. The advantage is you now have bullet physics just like everyone else running OpenSim 0.8.x! Yay! The downside of bulletXNA is it eats up a lot more processor power as your relying on the heavy handed mono engine to do all of the heavy lifting for you.

This is a classic case of the libraries getting far more advanced then the application they support. Perhaps in the future the OpenSim dev team will link to bullet3.so natively so we do not have to rely on compiling the libraries on every Linux box ourselves. Until that time comes. This is the best solution I can come up with thus far.

Installing libBulletSim.so (Bullet Unmanaged Mode):

Compiling bullet underneath debian wheezy was virtually impossible generating tons and tons of hard-crash errors as described by this blog. However, with the introduction of Debian Jessie on newer model of Pi’s compiling bullet 2.82 onto the ARM processor not only compiles with no errors, but is also stable for OpenSim usage now too.

to compile your own libBulletSim.so file, it’s a two fold process. The first part is making the bullet libraries from 2.82 (both the .h and .a files necessary for compilation)

apt-get update apt-get upgrade wget https://bullet.googlecode.com/files/bullet-2.82-r2704.tgz tar -zxvf bullet-2.82-r2704.tgz cd bullet-2.82-r2704 mkdir bullet-build cd bullet-build cmake .. -G "Unix Makefiles" -DBUILD_EXTRAS=on -DBUILD_DEMOS=off -DBUILD_SHARED_LIBS=off -DINSTALL_LIBS=on -DINSTALL_EXTRA_LIBS=on -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-fPIC" make -j4 sudo make install

Now we need to download the opensim-libs and get libBulletSim:

git clone git://opensimulator.org/git/opensim-libs cd /opensim-libs/trunk/unmanaged/BulletSim

Now before you type in make you may have to modify the “Makefile” to point to where the IDIR = /usr/local/include/bullet and LDIR = /usr/local/lib go to. Alternatively, you could simply bring all of the .a and .h files and make a /lib and /include folder inside of BulletSim accordingly.


if it compiles with no errors of files not found it should generate a brand spanky new libBulletSim.so

cp ./libBulletSim.so /path/to/opensim/lib/libBulletSim.so

Open your /bin/OpenSim.ini file with your favorite editor such as nano and add this to the bottom of your file.

[BulletSim] UseSeparatePhysicsThread = true TerrainImplementation=0 BulletEngine = "BulletUnmanaged" 

Next open /bin/OpenSim.Region.PhysicsModule.BulletS.dll.config for OS9.x or /bin/Physics/OpenSim.Region.Physics.BulletSPlugin.dll for OS8.x and replace everything in there with the following:

<configuration>   <dllmap dll="BulletSim" target="lib/libBulletSim.so" /> </configuration>

Like the ODE physics blog this will tell OpenSim where to look for said Physics file.

if everything goes well, it should find your new library and not have a horrible crash.

[quote]Can I just get the libBulletSim.so from you?[/quote]

libBulletSim.so binary download.

Most people in the Linux community will give you the lecture of how pre-compiled binaries and slamming them into other linux environments can produce unstable results, and they are right! But for those who do not want to go through all of the “fun” of compiling the uploaded pre-compiled version is available right here. This is originally compiled on a Orange Pi running Debian Jessie. It does work on the banana Pi which has a ARMv7 processor and it works on the Raspberry Pi 2 as well. If you have a different processor other then ARM or running another flavor of Linux then the pre-compiled version will not work out for you.

What’s faster? Bullet Unmanaged or Bullet Managed?

it seems like performance between the two are almost the same. They both eat up around %20 processor power of one core on my Banana or Orange Pi. Although the collision matrix seems to be a lot more accurate other things like sitting on objects is still a little flakey with bullet.

Click here to return back to the OpenSim tutorial for Raspberry Pi.


Leave a Comment to the Void