Howto: Use the Bullet 3D Physics Engine in Xcode

Its been a while since I added a Howto on here. Hope you find it useful.

The Bullet 3D Physics engine is shipped with the Oolong 3D Engine for iPhone. However, if you just want to use the physics engine in your iPhone app, the following steps should help you to integrate it into your project:

  1. Download Bullet. I got it as part of the Oolong Engine source from Google Code.
  2. Open Xcode Preferences, select Source Trees and add one with Setting Name “BULLET_ROOT” and Display Name “Bullet”. Give it the full path to your Bullet folder.
  3. In your Xcode project, CTRL+Click on Classes folder and select Add Group. Give it the name “Bullet”. Then CTRL+Click the Bullet group and select Get Info. Set the Path Type combo box to  ”Relative to Bullet”. The Full Path should show the full directory path for the Bullet folder.
  4. Select Project/Edit Project Settings from the Xcode menu. Search for “header search paths” in the Build tab and add the full path to your Bullet src. Make sure to check the Recursive checkbox. You will need to do this for Debug and Release build configurations.
  5. In your source code, include the relevant bullet header e.g.

    #include "btBulletDynamicsCommon.h"

    will include everything you need for rigid body dynamics.
  6. Check out the Oolong samples to see how to use the physics engine or head over to the Bullet website for more resources.

Hopefully, I haven’t missed anything out but let me know if you spot something incorrect or can’t get it to work.

Update: 21/07/09: One step I forgot to mention was that Bullet is written in C++. You iPhone application class files will default to Objective-C and so won’t be able to compile. You need to CTRL+Click the class file referrencing the btBulletDynamicsCommon.h header file, select Get Info and change its file type to be Objective-C++. That should allow it to compile properly.

Howto: Mount Windows Filesystem on Linux

It can be very useful to access your Windows filesystem on a dualboot computer (one with both Windows and Linux Operating Systems). Here’s how:

  1. Open a Terminal window and create a directory to mount on to:
    $ sudo mkdir /mnt/win
  2. For an NTFS Windows Filesystem:
    $ mount -t ntfs /dev/sda1 /mnt/win
  3. For a FAT32 Windows Filesystem:
    $ mount -t vfat /dev/sda1 /mnt/win
  4. Go to your mounted folder:
    $ cd /mnt/win

Note: Don’t type the leading $, its the prompt. This assumes that your Windows filesystem is the first partition and is called “sda1″. If not, change the relevant command above to point to the right name. Also, if it’s NTFS, it will probably be read only access so you won’t be able to copy files to it. If this is required, it may be a good idea to creat a separate FAT32 partition that would be accessible to both OSs for sharing files.