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 0.7.6.1 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.

make

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.

Binary download of OpenSim libraries.

All of this compiling libraries and modifying configuration files sucks! Don’t you have binaries for my Pi?

For those who want a snap-shot of the configuration files that I have altered above. you may download this file and unzip it into your /opensim/bin folder to replace the .config files and add the proper .so files into your /opensim/bin/lib/ folder. We will however give you the lecture that most in the linux community will do when it comes to binary files. Which is binary files are typically compiled for a specific environment (in our case that environment is Debian Jessie Raspberry Pi Armv7.) The results may be unstable and unpredictable if you attempt to install these binary libraries onto another Linux kernel. It should also be noted that you are trusting this website to provide the binaries instead of compiling from source yourself which could prove dangerous. Trust no one online and whenever possible always compile your own code.

 

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.

Related Blogs:

Click here to go to the original installation on how to install OpenSimulator.

Click here to install the ODE or Open Dynamics physics Engine for your arm processor.

Want to see what is going on with my Pi on OSGrid? Click here.

Want info on how to install 2.1.x for very early edition Raspberry Pi’s running ARMv6? Click here.

+++END OF LINE

Leave a Comment to the Void