Here’s some notes from my internal wiki.
How to export .bullet data from a Blender 2.5x scene (awfully close to 2.6 now ‘eh). This might be as of Blender 2.57, and should continue to work well in to 2.6x.
Exporting Bullet Data from Blender
Exporting Bullet Physics data from Blender is a pain in the ass. Plain and Simple. It *SHOULD* be a right click export, but no, it’s complicated.
- Switch to Game Engine Mode (In the Title Bar, the default setting is “Blender Render”. Should be “Blender Game”).
- Game Engine Mode changes the *Physics* Properties (bouncing ball)
- Make the Physics Type a “Rigid Body”
- Enable Collision Bounds, and pick a bounding volume type (boxes, hulls)
- To make compound objects, you need to treat one object as the parent, and check the compound buttons
* Under the *Object* Properties (tiny cube), Relations Parent can be used to identify oneself as a child of a parent
- Defining compound objects is required to make overlapping volumes that don’t affect each-other.
- Change a pane to a *Logic Editor* (little red-ball joystick)
- Add a “Keyboard” sensor, and set the key to the spacebar (for example… we’re binding the spacebar to an action)
- Add a “Python” controller
- Change a pane to a *Text Editor*
- Hit + to create an instance (default name is “text”)
- Paste the following script in to the text editor
import PhysicsConstraints; print( “Exporting…” ); PhysicsConstraints.exportBulletFile( bpy.path.ensure_ext(bpy.data.filepath,".bullet”) );
- Update the “Python” controller to use this script file
- Drag a link between the Keyboard sensor and the python controller (see the little nodes between them)
- If you haven’t already, save the .blend file. If you close Blender, then double click on the saved .blend file, it will change the current working directory of Blender. This is important, because the script above (with no path) saves the .bullet file to the working directory.
- Finally, to generate the blend file, run the simulation (R key).
- To export, while the simulation is running, push the spacebar.
- The console will show the “Exporting…” message. If you don’t have a blender console, you can enable it under Help->Toggle Blender Console
Done. That’s the annoying way to export .bullet data from blender.
The reason for the complicated procedure is that the PhysicsConstraints and bge libraries are just not available in standard plugin scope. Right clicking and running the script, just not an option. So we need to enter a game instance, where all these helpful library instances exist (as otherwise you wouldn’t have physics).
Research conducted on October 6th, 2011, using Blender 2.59.
References
http://www.blender.org/documentation/blender_python_api_2_59_3/bpy.path.html
http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=6683&p=23315#p23315