Bullet – physics installation for OpenSim

Introduction to Bullet:

Bullet is the modern physics engine that the OpenSim development team is heading towards during the version 8.x builds of OpenSim. Although it's only bullet version 3.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 allows 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 Bulletin 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:

bullet physics - libBulletSim.so-crash-on-startupFATAL 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 are 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 bullet XNA is it eats up a lot more processor power as you're relying on the mono engine to do all of the heavy lifting for you.

Installing libBulletSim.so (Bullet Unmanaged Mode):

Compiling bullets 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 a newer model of Pi's compiling bullet 3.x 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 3.x (both the .h and .a files necessary for compilation)

apt-get update
apt-get upgrade
wget -L -O bullet3-2.86.1.tar.gz https://codeload.github.com/bulletphysics/bullet3/tar.gz/2.86.1
tar -zxvf bullet3-2.86.1.tar.gz
cd bullet3-2.86.1
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

Note: This has now been updated from the old 2.82 bullet code to bullet 3 thanks to anonymous commenters for the information.

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

The binary download of OpenSim libraries.

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

Download Bone and Helper Files for StepMania Now!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 the source yourself which could prove dangerous. Trust no one online and whenever possible always compile your own code.

Final thoughts.

The performance between managed and unmanaged is 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 unmanaged other things like sitting on objects is still a little flakey with a bullet. However, if you were to contrast this against the rival physics engine ODE. Bullet seems a little slow and bulky for Metaverse-level activity. Perhaps when OpenSim embraces the new bullet 3 libraries with multi-core processing will we expect to see some real results from a physics engine like this one!

+++END OF LINE

9 thoughts on “Bullet – physics installation for OpenSim

    • I thought about getting Odroid myself just for the power and eMMC function. But the instructions were tried on multiple ARM based systems and so far has worked alright. The issues I had with compiling bullet came down to using an debian wheezy which was too old. When I used something newer then wheezy it compiled fine and did not crash.

      Reply
  1. they are saying in /opensim-libs/trunk/unmanaged/BulletSim/BUILD.TXT
    "This was developed with Bullet v2.86."

    so compiling bullet for opensim-0.9.0.0 might be done with 2.86.
    i got it from https://github.com/bulletphysics/bullet3/releases

    so the updated code might look like this:

    wget -L -O bullet3-2.86.1.tar.gz https://codeload.github.com/bulletphysics/bullet3/tar.gz/2.86.1
    tar -zxvf bullet3-2.86.1.tar.gz
    cd bullet3-2.86.1
    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

    seams to work for me.

    Reply
    • Excellent! I remembered having a lot of problems with the old Opemsim bullet which is why we used that version. But that was a rather long time ago. Tonight we'll compile the physics 3 and see how it goes. if it works out we'll update the entry so that we're up to date on our physics.

      Super thanks for taking the time on this!

      Reply
    • Hello,

      Just wanted to let you know that the blog has been updated with the new bullet 3.x. Also the binaries have been updated as well. Thanks for the update and let me know if they come out with a multi-core version of bullet for OpenSim as this would help is tremendously in the ARM processing community.

      - S

      Reply
    • Thanks for the update!

      Looks like they archived bullet. I've hyperlinked it now so if it moved again WordPress will tell me. Also, In the rare event it disappears completely off of google code I'll host it locally.

      Thanks again for checking out my blog!

      Reply

Leave a Comment to the Void