8

I've been looking at different ways of creating a certain physics simulation. What I am trying to do is to 3D model the motion of a body under the effects of various forces over time. I was originally looking at coding something in c++ using a physics engine (Bullet) and a 3d engine (Irrlicht). However, I noticed that Blender already allows one to do physical simulations since Bullet is integrated with it (correct me if I'm wrong). This seems like it would make it much easier to design the simulation exactly how I want it (with Blender's extensive GUI).

My issue is that I would like to use the results from the simulation (basically x,y,z,pitch,roll,yaw of the body at each timestep) for input into c/c++ code (or another language if its much easier for this). Can this be done with Blender? Is there a better software package for this that I am overlooking? Thanks, any advice is appreciated.

jww
  • 97,681
  • 90
  • 411
  • 885
Anon
  • 5,103
  • 11
  • 45
  • 58
  • 1
    Do you want this to be a real-time process, or do you want files to be involved? What I'm asking is if you want to do inter-process communication directly with Blender, or is it OK for a user to export the simulation animation into a file, which your program then loads? – Nicol Bolas Jun 21 '11 at 19:07
  • Either is an option really, but I'd like to stick witch whichever is easiest to implement and most accurate. Is it easy to load outputs from blender? – Anon Jun 21 '11 at 20:37
  • @William: Well, considering that Blender doesn't have any inter-process communication facilities, and therefore you'd have to write them into Blender to do so, yes, it's easier to read from a file ;) – Nicol Bolas Jun 21 '11 at 20:51
  • Why do you want to extract these values? Do you want to do something with them besides visualizing the objects? If not, you could even have a look at the Blender Game Engine. – Bart Jun 21 '11 at 21:26
  • which kind of physical simulation are you talking about? if it is about molecular, pymol would be your friend to generate fancy graphics – Open the way Jun 21 '11 at 21:26
  • @Bart: I do need to do additional processing with the position/attitude information, not just visualization. – Anon Jun 21 '11 at 23:25
  • @gpu_drg: pymol looks really cool, but unfortunately this isn't molecular. I'm dealing with a much larger body that is subjected to gravity, various thruster forces, and pressures. – Anon Jun 21 '11 at 23:26

2 Answers2

3

I would use a Python script for that task, as Blender has a nice interface getting/setting the objects and their properties programmatically through .py files.

So after you are done with your animation you can call a script to walk through the frames and save the required data into a file.

A getting started doc can be found here: http://wiki.blender.org/index.php/Doc:Manual/Extensions/Python or here: http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro

There is a huge list of scripts worth browsing for similar routines you need. http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts

Bálint Fodor
  • 1,030
  • 9
  • 12
1

As mentioned before, it would be very easy to use python for this. For more specific use if using Blender, perhaps you should consult the main Blender forum www.blenderartists.org

Blenderartists python support: http://blenderartists.org/forum/forumdisplay.php?11-Python-Support

Blender 2.5 code snippets (Introduction to scripting for Blender 2.5): http://blenderartists.org/forum/showthread.php?193908-Code-snippets.-Introduction-to-Python-scripting-in-Blender-2.5x

Sycren
  • 539
  • 2
  • 5
  • 15