PDA

View Full Version : Create Targeted Camera from Values in a Text File?


bnvm
09-15-2004, 07:37 AM
am a newb when it comes to maxscript. I would like to make a script that creates targeted cameras from a text file containing the camera name xyz camera locations xyz target locations roll angle, field of view and check the box for use look at up z in the controlers menu. I have been trying for a while now with no luck any advice would be great.

The text file will look something like this

Camera A,1,2.5,3,5,7,8,2.5,37
Camera B, 3,4,6,6,8,9,3,45

in the format

camera name, x,y,z,tx,ty,tz,roll,fov

thanks in advance for your help.

-bnvm

Wahooney
09-15-2004, 08:32 AM
What you're gonna want to do is use a tokeniser of some sort.

I would use filterstring() for this one.

myFile = OpenFile "Cameras.txt" // open the file
seek myFile 0 // make sure you're reading from the first character
myString = readLine myFile // read the first line into your string
myTokens = filterString myString "," // Get the tokens

// This will give you an array of strings, ie.
myTokens = #("camera name", "x", "y", "z", "tx", "ty", "tz", "roll", "fov")


Just go through each element cast it to a float if needs be and Bob's your uncle.

I suggest you go through this code and reference everything in your help and see what everything does, it helps to understand :)

I hope this helps

bnvm
09-15-2004, 03:37 PM
Great thankx I will give that a look over. I sure appreciate your help.

-bnvm

CGTalk Moderation
01-19-2006, 07:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.