This tutorial will guide you through the configuration of an OgreBullet project from configuring the components to creating your first compilable but empty project. My native language is not English so if you find grammatical errors, please post a comment. Thanks!
What you need:
- Ogre 1.65 (must be already configured). This tutorial has also been reported to be compatible with Ogre 1.7.1.
- Bullet 2.76 (you can download from here)
- OgreBullet (I used rev. 2902, svn at the time of writing: link)
IDE I used and will refer to:
- Visual Studio 2008 C++ Express with SP1
Also good if you have:
- Ogre AppWizard (the basic project is generated with this. Wiki: The Complete Blanks Guide To Using The OGRE SDK AppWizard)
Unpack Bullet and place OgreBullet somewhere on the hard drive.
Create a new environment variable for Bullet.
BULLET_HOME: C:\OgreSDK\AddOns\bullet-2.76 (if this is where you unpacked Bullet).
Note: At least as of revision 2978, the project is configured to use the environment variable BULLET_ROOT instead.
Note: You can set environment variables in Windows XP by following these steps: open Control Panel (classic view) / System / Advanced / Environment Variables. Set it in the User Variables box.
Build Bullet in your IDE (I did it in VS2008 Express).
From Bullet's root folder, the project file for VS 2008 is here: msvc/2008/BULLET_PHYSICS.sln. Build it in Debug and Release modes; it should compile without any problem.
The .sln file is in the OgreBullet folder. Depending on your version, it may be called OgreBullet_SDK.sln or OgreBullet_VC8.sln.
Note: You may need to alter Include directories if you're using a newer version of Ogre.
When you build the debug version of the demos, you may have some errors about missing .lib files. Put these files in ....\OgreBullet\lib\Debug\:
|File||Can be found in|
There are some other files that we don't need now but that you may need later, for example BulletSoftBody.lib. If something is missing when you use more components from Bullet, don't forget to copy it to the right place.
Note: If you want to compile/run the OgreBullet demos supplied with OgreBullet and it can't find resources.cfg, don't wonder. This tutorial is not about these demos but I think you can solve this problem yourself. There are some problems with paths
If you want to build the Release version of the demos (or any OgreBullet project!) you'll need to copy Bullet's .lib files to ....\OgreBullet\lib\Release. But beware! You have to put the RELEASE version of the .lib files to this directory, not the files listed above.
Now that we have the required files, let's close this project and start a new one!
If you have the Ogre AppWizard installed, create a new Ogre project: New project –> Ogre SDK Application –> OgreBullet_Collision_test –> Finish
I'll refer to classes whose names have been generated from the project's. Be careful if you want to use another name.
If you don't have the AppWizard, just create a basic Ogre application that is able to create a window, fire up a FrameListener and deal with keyboard/mouse input handle. If you don't know how to do this, there's a tutorial for it. From now on, I will refer to the AppWizard basic project.
Before we start coding (in the next tutorial) we need to do some configuration. Open the project's properties (Alt + F7) and do the following:
- Go to Configuration Properties > C/C++ > General
- Find Additional Include Directories, open with '...' button
- Add $(BULLET_HOME)\src to the list
Do this for both Debug and Release modes (with the dropdown menu in the top-left corner of the window).
- Now go to Configuration Properties > Linker > Input
- Find Additional Dependencies
- Add the required elements. In the end it should contain these:
OgreMain_d.lib OIS_d.lib OgreBulletCollisions_d.lib OgreBulletDynamics_d.lib bulletcollision.lib bulletdynamics.lib LinearMath.lib GIMPACTutils.lib ConvexDecomposition.lib
- Change the Configuration (in the top-left corner of the window) to Release and insert these to the same place as before:
OgreMain.lib OIS.lib OgreBulletCollisions.lib OgreBulletDynamics.lib bulletcollision.lib bulletdynamics.lib LinearMath.lib GIMPACTutils.lib ConvexDecomposition.lib
In the current SVN version of OgreBullet (rev2984) and Bullet version 2.78 (rev2387), the libraries names are different:
Release: OgreMain.lib OIS.lib OgreBulletCol.lib OgreBulletDyn.lib BulletCollision.lib BulletDynamics.lib LinearMath.lib GIMPACTUtils.lib ConvexDecomposition.lib
Now close this window and go to Tools > Options > Projects and Solutions > VC++ Directories:
- Set Show directories for: Include files
- Put these paths in the list (including the path to OgreBullet):
- Change to Library files and put these in the list:
Build the project. If all went well, you can now start the next tutorial which is based on this project
NOTE: Source code can be found at the end of the second tutorial.
On to OgreBullet Tutorial 2!