[CLOSED] Blender animation of force field with clothes import to JME

Hi @Denis_Tislenko
Very sorry for late reply! I am busy doing my military service and we have no access to internet there. I can visit forum only on weekends :disappointed_relieved:

For physic rigid body simulation you can do like in video ā€œBake Physics to Keyframe Animationā€ to bake the physics simulation to blender keyframe animation (which is called SpatialAnimation in JME). Note you should export it to xbuf format for using in jme because as far as I know only xbuf is able to export SpatialAnimation from blender.

When I export via wavefront obj, 100 objects are created (1 for each frame), and I am not sure how to join them back to one j3o to get animationā€¦

** (First make sure you know about Spatial, Geometry and Mesh in JME.)

Regarding cloth simulation like flag waving, what I am doing is, after creating a flag simulation in blender (using blender cloth simulation) and exporting it as obj files (for example if your simulation is 100 frame it will export 100 obj files ). Then you need to load those obj files in jme, now for playing animation you need to switch the Mesh with time. For example for having a 30 fps animation speed you need to change the meshes after 1/30 second.
So for example for flag animation with 100 frame (100 obj files) you load all files and keep them in an array or list then start from the first geometry and after 1/30 s switch the geometryā€™s mesh with the second mesh and after another 1/30 s set the third mesh and so on.
Now you can set the array or list as UserData on spatial and save it as j3o (see wiki for how to save Spatial as j3o). After saving it as j3o you can delete all .obj files. The reason I am saying to save all in a j3o file instead of 100 separate files is that loading from hard disk is faster in first case.

Edit:
Note that this approach may not be a good approach for cloth simulation because of huge data size on disk and memory. Recently I have found about toxiclibs physic library for real time cloth simulation using Verlet integration but have not tried it yet. You might be interested to take a look at it :

1 Like