Bullet Physics cplusplus CHOP


Sometimes I get a bit impatient and I couldn’t wait for the python physics lib to work in Touch088, so I had a go at implementing Bullet as a CHOP.

Didn’t spent much more than half a day on this, so it’s really basic, but it already allows for some cool little animations like vimeo.com/71671285 :wink:

Source : github.com/vinz9/BulletCHOP
Sample file with x64 version : github.com/vinz9/BulletCHOP/releases
(x86 should work with Touch077 I guess but people who can load .dll have access so 088 anyway so…)


Thank you for (always) sharing your code and patches!

Thanx for Share Dude , I opened it in TD but the CPP Chop gives an error :“Failed to Load the .dll”

any solution for this ?!

You’re welcome Achim, I learned a lot from the community so just trying to give back a bit :wink:

The version I posted previously could only work in Touch088 x64 version. Now I just updated the zip file with a x86 version of the dll and a touch077 example file. But be aware it won’t work in Touch077 FTE, since this version doesn’t allow the loading of .dll (last time I checked).

Hope it clears things up for you!


It’s also possible you don’t have the proper redistributable installed for whatever version of MSVC it was compiled in. Search for Visual studio 2010 redistributable (or Visual studio 2012) depending on which version it was compiled for.

Thanks for the precision Malcolm, I compiled it with vs2010.

Sweet!!! I’ve been wanting to experiment with Bullet Physics in Touch for a while. Awesome!!


Thanks for sharing!
Would you mind sharing or pointing to the right procedure to get the bullet libs installed? Never installed libraries of this type before…


Hi Rurik,

The cplusplus chop is using Bullet, but you only need to get the bullet source code/compile the bullet library if you want to compile the cpluscplus chop yourself.
Bullet is designed as static library so no additionnal dll is needed.

If you want to make some modification and compile the cplusplus chop then you need to get bullet 2.81 source from code.google.com/p/bullet/downloads/list, compile the static libs (using the vs2010 project file) and point to these in the BulletCHOP vs2010 project settings.


Hey guys,

This is an awesome little addition you have put together!

I am having a recurring issue however with the 64 bit 088 version that is pre compiled - it crashes almost all the time!!

I am about to give it a go with the 32bit version, hopefully more stable?



There shouldn’t be any difference between the 64-bit and 32-bit versions in terms of stability. Can you send your. dmp files to support@derivative.ca and we’ll see what the issue is?

Hi Malcolm,

Cheers will do when I get back to that computer tomorrow!



Malcom is right, there shouldn’t be any difference between 32 and 64bits version.

There’s not much error checking made in the code, maybe changing the number of objects on a different frame than 1 crashes for example, I’ll need to have a look.

Keep in mind this was done as a quick exercise and to show a starting point to add physics in Touch, but is not production ready, and you need to some c++ knowledge to extend it.
I’ll definitely work on it again at some point though I don’t know when.


Hi Vincent,

Cheers - I do believe it is probably me trying to push something a little further than it is meant to be pushed yet… I am trying to create a realistic hourglass simulation with particles (particles running through an hourglass-ish geometry- the collision object) - and running the particle positions through the bullet physics then instancing rects at the particles updated positions. I imagine this is just too heavy for it at this stage?

I would love to be able to extend this, but my C++ knowledge is pretty limited. I guess I just have to wait until physics are built into touch!

O. :slight_smile:

Working with this now - thank you for making it - but I’m running into a minor problem.

It looks like the ‘static’ geometry needs to be passed in as a CHOP with samples for each quad in the fixed geometry - pos, orientation and XYZ scale, as far as I can tell.

I can work with that - assuming two many quads don’t slow it down too much, but how would I convert a SOP consisting of quads in a mesh into those quads?

Is there a SOP operator to do this? Or do I need to build the collision geo manually from quads (yuck).

I guess a script could work?


I think you actually need to work with triangles not quads.
continuousphysics.com/Bullet … a504558583 and
“btBvhTriangleMeshShape” for static geometry bulletphysics.org/mediawiki-1.5. … ion_Shapes

You can use this toe file to turn a polygon mesh into a DAT list where each row contains the xyz of three vertices. I was able to modify the BulletCHOP code and bounce boxes off a noisy sphere.

video: vimeo.com/130634280
SOP_Triangulate_DAT.1.toe (4.53 KB)

hej. why would i need a pro version to play around with cplusplus?



You only need a Commercial version to work with the C++ nodes. Pro is not needed.

EDIT: C++ nodes work with any license type now, as of 2019.10000 builds.

A minor bug in BulletCHOP.cpp is that
output->channels[QX][index] = float(rot.x());
should be
output->channels[QX][i] = float(rot.x());

Has anyone set up a collision callback function? I set up the callback with https://gamedev.stackexchange.com/a/120881 When numContacts is greater than 0 I think that the objects have collided. Then I check what type they are with a custom struct MyData and
MyData * myData = (MyData *) (obA->getUserPointer()). The MyData struct should have been created with setUserPointer() when I created the object.