Reading Object Pos&Angles from text file
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/11/2004 at 05:06, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.100
Platform: Windows ;
Language(s) : C.O.F.F.E.E ; C++ ;---------
I want to to use C4D R9 for a visualization. I have text file containing x,y,z position and x,y,z angles (attitude) of an object.How can I create an animation of an object by reading its position and attitude (angles) from an external file ?
Each line in the file represent a new frame data (new position and new attitude) with the following entries;
Format:
FrameNo Xpos Ypos Zpos Xangle Yangle Zangle
Data file Example :
1 1.0 0.0 0.0 0.5 0.0 0.0
2 1.1 0.2 0.0 1.0 0.0 0.0
3 1.2 0.4 0.0 1.5 0.0 0.0
4 1.3 0.6 0.0 2.0 0.0 0.0
...
5000 -1.4 -12.0 340.0 45.0 125.4 -3.0Assume that we have a spacecraft object in C4D.
What I want to do is for each frame read the the next line from the data file and move the spacecraft to Xpos, Ypos,Zpos and rotate it by Xangle, Yangle, Zangle. Repeat this process until no mode data line left in the data file ie. create 5000 frame movie.Can you suggest any method how to do this?
Thanks
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/11/2004 at 09:14, xxxxxxxx wrote:
You need to set up keyframes for the object's position and rotation for each 'frame' of data, setting the keyframe values from the file. In C++, there are several posts here that show how to do this, a couple of examples in the SDK code, and do not forget the SDK documentation. Check out Plugins/cinema4dsdk/source/MorphMixer.cpp.
What you want to do is very similar to importing BVH data which is motion capture data at a regular time sample. Code to this effect would be easily converted to your purpose.
For starters, select Show Topics "All", do a Search for "keyframe" using Search In "Message Body". This will give you plenty to get started.