Meaty

07-03-2003, 05:11 PM

Okay, I have offically taken the plunge into Lscript. It came upon a need to be able to parse lat/long/alt data from text file into layout to animate a Null.

Okay, so I started off just trying to get my script to perform the lat, long, alt to x,y,z conversion, and I was actually successful. But I am afraid that is where my success stopped.

The next step(s) i want to accomplish is to first be able to move a null and keyframe it given the lat, long, alt information. After that, I want to be able to do it in mass kinda like loading a motion file, but with just the columns lat,long,alt,frame# going straight down in a text file.

Below is the code I have so far. Any help would be great, thanks.

@script generic

@name LATLONGTOXYZ

@version 2.6

generic

{

//CONSTANTS

Re = 6378137; //Radius at equator

E2 = 0; //Eccentricity squared

//Draw the interface

reqbegin("Lat. Long. to XYZ");

c0 = ctlnumber("Latitude: ", 1);

c1 = ctlnumber("Longitude: ", 1);

c2 = ctlnumber("Altitude: ", 1);

ctlposition(c0, 35, 5);

ctlposition(c1, 35, 30);

ctlposition(c2, 35, 55);

return if !reqpost();

//Get the values from the interface.

lat = getvalue(c0);

long = getvalue(c1);

alt = getvalue(c2);

//perform calcs

reqend();

x1 = (Re + alt) * cos(lat*PI/180) * cos(long*PI/180);

y1 = ((1 - E2) * Re + alt) * sin(lat * PI/180);

z1 = (Re + alt) * cos(lat * PI/180) * sin(long * PI/180);

//Display the calcs.

info("x = ",x1);

info("y = ",y1);

info("z = ",z1);

}

Okay, so I started off just trying to get my script to perform the lat, long, alt to x,y,z conversion, and I was actually successful. But I am afraid that is where my success stopped.

The next step(s) i want to accomplish is to first be able to move a null and keyframe it given the lat, long, alt information. After that, I want to be able to do it in mass kinda like loading a motion file, but with just the columns lat,long,alt,frame# going straight down in a text file.

Below is the code I have so far. Any help would be great, thanks.

@script generic

@name LATLONGTOXYZ

@version 2.6

generic

{

//CONSTANTS

Re = 6378137; //Radius at equator

E2 = 0; //Eccentricity squared

//Draw the interface

reqbegin("Lat. Long. to XYZ");

c0 = ctlnumber("Latitude: ", 1);

c1 = ctlnumber("Longitude: ", 1);

c2 = ctlnumber("Altitude: ", 1);

ctlposition(c0, 35, 5);

ctlposition(c1, 35, 30);

ctlposition(c2, 35, 55);

return if !reqpost();

//Get the values from the interface.

lat = getvalue(c0);

long = getvalue(c1);

alt = getvalue(c2);

//perform calcs

reqend();

x1 = (Re + alt) * cos(lat*PI/180) * cos(long*PI/180);

y1 = ((1 - E2) * Re + alt) * sin(lat * PI/180);

z1 = (Re + alt) * cos(lat * PI/180) * sin(long * PI/180);

//Display the calcs.

info("x = ",x1);

info("y = ",y1);

info("z = ",z1);

}