View Full Version : Fly a real trajectory

09-09-2004, 07:36 AM
Is it possible to give an object a real trajectory?

example: I have X,Y,Z and H,P,B coordinates for an object for a given amount of time. I used to be able to paste the trajectory in the .lws scene file in Lightwave[5.5]. Now (in Lightwave[8]) the motion information is embedded somewhere in the scene file.

Can I write a script to pull in the motion for this object? It would be tab delemited (sp?) text file with the first 3 columns being x,y,z postion and the next 3 columns being h,p,b rotation.

Any help is appreciated!

Thanks! :)

09-10-2004, 04:53 AM
it would be relatively easy to parse any kind of ascii file you might have.

if you have a file that's formatted something like this:

[x] [y] [z] [h] [p] [b]

and we assume that every line is one frame:


a = "c:\\temp.txt";

s = Scene().firstSelect();
c = s.firstChannel();
if(c.name == "Position.X")
xchan = c;
if(c.name == "Position.Y")
ychan = c;
if(c.name == "Position.Z")
zchan = c;
if(c.name == "Rotation.H")
hchan = c;
if(c.name == "Rotation.P")
pchan = c;
if(c.name == "Rotation.B")
bchan = c;

c = s .nextChannel();

f = File(a,"r+");
error("No file.");
i = 0;
line = string(f.read());
(x,y,z,h,p,b) = parse(" ",line);

xchan.createKey(i / Scene().fps,number(x));
ychan.createKey(i / Scene().fps,number(y));
zchan.createKey(i / Scene().fps,number(z));
hchan.createKey(i / Scene().fps,number(h));
pchan.createKey(i / Scene().fps,number(p));
bchan.createKey(i / Scene().fps,number(b));



you have to modify the script so that it points to the file you want. make sure the text file has one extra line at the end, and only one. select the object, and run the script.

09-10-2004, 12:07 PM
wow, thank you very much!

If I have any more questions, can I just PM you?

09-10-2004, 09:11 PM
of course, no prob.

09-11-2004, 08:50 AM
curious. but why not save the motion with commandinput and load it onto the object you want?

just realized you didn't want the motion for another object, but for display. regardless, could you use the same method and parse the mot file?