ofxMSAPhysics 1.2

New version at http://addons.openframeworks.cc/project-…-msaphysics
this requires ofxVec3f and also http://addons.openframeworks.cc/project-…-bjcpointer

not documented yet (hopefully header files should be enough in the meantime) but new features include:

  • save/load physics data for every frame for replay recording and playback
  • empty virtual update(), draw() functions if you want to create your own particle type or constraint type and add to the system
  • pluggable updater and drawer objects for forcefields, custom drawing etc attachable to either the entire system or individual/groups of particles
  • can set drag per particle as well as for whole system
  • random fixes and improvements behind the scenes

here is the old demo for the 1.0 version http://www.vimeo.com/1840876
no demo for 1.2 yet (apart from the My Secret Heart video)

Cool! I’ve tried it! awesome!

(using the ‘old example’ :slight_smile: :slight_smile:

Hey gatokaca, how do you mean

But, maybe the implementation of ofxObjCPointer missing ‘setClassName’ and ‘setInstanceName’ though it is not a major problem

Are they not implemented in the version you have? Maybe I made local changes to ofxObjCPointer and forgot to upload. Just updated the addons site with 1.02, does that fix any issues?

I originally created OFXMSADATARECORDER as a separate addon, as its not directly related to the physics addon. And I use it for caching and replaying other types data as well (user input, variables etc). But for the sake of distribution, I didn’t want to make the physics addon rely on too many external addons, so I just packaged it in physics for now.

The ideal scenario is to have the DataRecorder as a separate addon. And if you don’t have that addon, the physics replays are disabled. If you do have the addon, replays are enabled. I also have a fluid addon (which i’ll put out later today probably), and have a ParticleUpdater class for that which plugs the fluid into the particles, also the same with optical flow (pluggable into the physics/particles). I’d like to make all of these conditional compiles in the physics, so the fluid-particle forcefield isn’t its own addon! If you have the fluid addon, and the physics addon, the fluid-particle class is automatically included and compiled.

Unfortunately #ifdefs dont work for this for reasons I explained here

I think the “MyAddons.h” approach would solve this issue. A clean solution to this I think would benefit us all!

Well, since you didn’t use the ‘getter’ of className or instanceName on your current implementation (of the physics); I had just put my own string properties of className and instanceName and its corresponding methods for {get,set} on my local copy objCPointer. By then I could run the provided example.

About that data recorder, I agree with you, that should be nice if we treat like that.


A word of caution, which I probably should have put in big bold letters in a readme or something…

you need to make the following mod to openFrameworks >> utils >> ofTypes.h

class ofPoint {  
	virtual ~ofPoint() {}		// this line is new  

Otherwise anything that points to an extension ofPoint (e.g. ofVec3f or ofxMSAParticle) through its base class won’t be freed correctly (more details at http://forum.openframeworks.cc/t/pretty-important-tip-about-destructors/1196/1)