I have a ball that I have modeled in my own code, and it bounces around inside a box. I would like to visualize this based on the output from my code. How can I import position data as a function of time for a moving object in 3D space? What data does blender need and what format is needed? What Blender commands are needed to import this data?
hi, probably a simple way would be to have your program export position data to text output, and use a python script in blender to read it in and do whatever you want with it. The python subforum should be able to help you out with that.
the simplest “format” would just be an xyz position per line, and a line for each frame.
if you mean some way of getting your code to run and talk to blender concurrently, I believe that should also be possible but you’d want to talk to someone more versed in the API.
also, if you just want to visualize it, have you considered just using straight opengl calls in your code? barring that, Visual C, python, whatever language you are using, there should be an pre-existing, publically available wrapper around basic opengl code that you can call directly from yours and not worry about exporting etc. This would have the benefit of immediate feedback, though your code would now have a few external dependencies.
something to think about. I can’t point to any off the top of my head, but I know I have used stuff like that when I was learning to code in python.
Thanks for the response. I would like to keep it simple by post-processing the results in Blender. Besides position data, I also have orientation data in the form of quaternions so I would like to see how the object rotates as it moves around. I would like to keep everything in Blender since I have some familiarity with it and have seen its capabilities. Your suggestion about outputting frame data per line should be easy to do.
Regarding the Python script, I would need to learn the basics that would allow me to load in the data and apply it to the applicable object (i.e. ball) so that it can be animated. How do I obtain Python and integrate it with Blender? Is Python compatible with any version of Blender? If this has been done before, can you point me to a reference or send me an example code?
I appreciate any assistance that you can provide. Let me know if you have any questions of me.