[Closed] Create Targeted Camera from Values in a Text File?
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
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
Great thankx I will give that a look over. I sure appreciate your help.
-bnvm