Setting Up a Bullet Physics Project

From the forum http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=8656: “Installing Bullet system wide (using shared libraries or frameworks) is not actively supported, so it relies on people contributing. For most users, it is recommended to simply add the Bullet source code files to your project and build and link it statically, along with other C++ source code files.”

But using Bullet system wide is the other alternative. Here are the instructions for using Bullet system wide in OS X 10.8  (using Bullet 2.81-rev2613):

 

Download bullet and unzip

In terminal,

cd path/to/bullet
mkdir bullet-build
cd bullet-build
cmake .. -G "Unix Makefiles" -DINSTALL_LIBS=ON -DBUILD_SHARED_LIBS=ON -DFRAMEWORK=ON \
-DCMAKE_OSX_ARCHITECTURES='i386;x86_64' -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=/Library/Frameworks -DCMAKE_INSTALL_NAME_DIR=/Library/Frameworks \
-DBUILD_DEMOS:BOOL=OFF
make -j4
sudo make install

Create a new C++ (command line tool) project in Xcode

Add “/Library/Frameworks” to Framework Search Paths in Build Settings of target

image00

Try the line

#include <BulletDynamics/btBulletDynamicsCommon.h>

in main.cpp and compile

If you get the error ‘BulletCollision/CollisionDispatch/btCollisionObjectWrapper.h’ file not found then this header file was not installed in /Library/Frameworks

Copy the file from

path/to/bullet/bullet-build/src/BulletCollision/BulletCollision.framework/Versions/2.81/Headers/CollisionDispatch

to

BulletCollision.framework in /Library/Frameworks

If you are having trouble with the following build errors:
“btTypedConstraint::serialize(void*, btSerializer*) const”, referenced from:
“btAlignedFreeInternal(void*)”, referenced from:
then you have to include the Bullet frameworks in your Xcode project. Navigate to /Library/Frameworks and then drag the Bullet frameworks into your Xcode project. You need at least LinearMath.framework and BulletDynamics.framework. (Those two will fix the above linking errors.) But you probably also want BulletCollision.framework and maybe others. (This step was taken from here.)

Advertisements

Curve Vectors Tool

https://gist.github.com/1223185

This script finds a vector from a curve. I needed it for orienting a follice to the same direction as the curve’s base, which corresponds to the first two cvs. After writing it, I realized that using edit points (ep) or curve points (u) would give a more accurate direction. Good enough for now, but will rewrite it.

UPDATE: Turns out that I could just use the pymel function tangent to accomplish the same thing (i.e. finding the tangent at a given point on a curve). For example, to find the tangent at parameter 0, which is the start of the curve, execute curv.tangent(0)