Question

Is there any library that I can use to do simple 3D stacking simulation in python? To simplify the issue, all objects are box with integer width / height / depth / top / left / z-index. And the only thing need to be simulate is determine the stacking is stable or not.

I am currently searching some physical engine to do this job.

vpython http://vpython.org/contents/doc.html

box2d http://box2d.org/about/ It does stable stacking well, except it is 2d.

An stable stacking sample From box2d enter image description here

EDIT1

I finally end up with using Chrono:PyEngine. It is really easy to use and the python binding is up to date. The only thing hard I found is that the latest version only support python 3.X http://www.projectchrono.org/mediawiki/index.php/ChronoPyEngine:Introduction

EDIT2

My Sample code to run stack checking with Chrono:PyEngine. https://github.com/lucemia/box/blob/master/physical.py

Was it helpful?

Solution

This is one of those questions with no really satisfying answer. But take a look at these:

  • https://www.ibm.com/developerworks/library/os-physicsengines/.
  • pyODE (ODE exported to python), but latest is from 2010 and supports up to python 2.6; the C++ side seems to be actively maintained
  • newton which has python bindings but latest release (even C++ backend) again not updated since 4/2011;
  • bullet which is actively maintained at the C++ level but the python bindings have not been updated in about a year and down't know how comprehensive and stable
  • reactphysics3d is C++ but actively maintained: need to create python bindings
  • havoc: not free and no python bindings, but appears most powerful

If you are willing to learn SWIG (www.swig.org) you can probably create your own Python binding for the parts of Bullet or PyODE or reactphysics3d that you want. Don't know about Havoc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top