ofxMSAPhysics is an opensource, C++ 3D particle/constraint based physics library for openFrameworks 006+ and Cinder. It uses a very similar api to the traer.physics library for processing, to make transferring code from processing / traer to C++ as painless as possible.
The source code for the above demo is included with the library as an example to demonstrate how to use the features.
Main features include
- attractions (+ve or -ve)
- replay saving and load from disk (temporarily disabled in current alpha release)
- custom particles (extend ofxMSAParticle and add to the system)
- custom constraints (extend ofxMSAConstraint and add to the system)
- custom force fields (extend ofxMSAParticleUpdater and add to the system)
- custom drawing (extend ofxMSAParticleDrawer and add to the system)
ofxMSAPhysics requires my ofxObjCPointer v1.1+ addon which makes memory management easier. It does not require ofxVectorMath anymore as the required functionality is now in the new OF core.
You can download ofxMSAPhysics from my github repo.
List of new features (from changelog):
- a lot of new files in this one, so you’ll need to remove and re-add it to your project
- no longer requires ofxVectorMath
- attractors fully implemented
- collision (between particles) fully implemented
- you can enable/disable collision per particle, and it will collide with all other particles which have collisin enabled
- AND/OR you can globally enable or disable collision
- AND/OR you can manually create a collision constraint between any 2 (or more) specific particles
- you can set world dimenensions for optimized collision (using Zach L.’s binning code) and particle world edge collision
- particles have individual drag
- particles have individual bounce (for collision)
- particles have individual size (for collision and rendering)
- all ‘setter’ methods return the instance so you can chain them (e.g. myParticle->setMass(1)->setBonuce(0.5)->enableCollision()->makeFree(); )
- replay functionality temporarily disabled while I fix stuff
- intense testing of memory management so should be stable as a rock, lemme know if you see anything weird (turn verbose on to see whats going on)
- using the super fast inverse square root approximation (attributed to john carmack but originally from Silicon Graphics)
- lots of internal restructing and optimization
ofxMSAPhysics is an opensource, C++ 3D particle/constraint based physics library for openFrameworks 006+ and Cinder. It uses a very similar api to [...]