home products news downloads documentation support gallery online maps resellers search
TNTmips Downloads Menu

HOME

CONTACT US

CURRENT RELEASE
  TNT 2013

DEVELOPMENT VERSION
  TNT 2014

TNTmips Pro
PRIOR RELEASES
  TNT 2012

FREE SOFTWARE
  TNTmips Free
  TNTatlas
  TNTsdk

MORE DOWNLOADS
  HASP Key Driver
  Screen Recorder
  TNT Language Kits
  Sample Geodata
  TNT Scripts

DOCUMENTATION
  TNTmips Tutorials
  Tutorial Datasets
  Technical Guides
  Scripts
  Quick Guides

MORE INFO
  Download FAQs
  FTP
  Download Managers
  Find Reseller

SITE MAP


FlyPath.sml


# FlyPath.sml

# startup script for TNTsim3D to loop through a flight path created by the
# SMLrecorder and saved as a text file named path.txt.

#####################################################################################
###  For a script to run under TNTsim3D, it must include an instance of
###  class TNTSIM3D named "TNTsim3D".  The script must also be saved as an RVC
###  object in the TNTsim3D Landscape File you want to run it with.
#####################################################################################

# declare class instance for TNTsim3D interface class
class TNTSIM3D TNTsim3D;

# turn on default sky
TNTsim3D.SetSky(1);

# declare arrays to hold viewer position coordinates and orientation angles in memory
numeric maxindices = 10000;
array numeric viewerx[maxindices];
array numeric viewery[maxindices];
array numeric viewerz[maxindices];
array numeric orientationx[maxindices];
array numeric orientationy[maxindices];
array numeric orientationz[maxindices];
numeric numindices = 0;			# number of indices in array set
numeric index = 0;				# current index during play

# set name of text file containing the saved flight path
string filename$ = _context.ScriptDir + "/path.txt";

# exit script if no path text file
if (fexists(filename$, "r") == 0) Exit();

# open path text file, convert positions to numbers and read into numeric arrays
class FILE file = fopen(filename$, "r");
string string$ = "something";		# variable to hold line of text from file
numindices = 0;
while (string$ != "") {		# while string is not empty 
	string$ = fgetline$(file);		# read line of text file to string
	if (NumberTokens(string$, ",") != 6) continue;
	viewerx[numindices] = StrToNum(GetToken(string$, ",", 1));
	viewery[numindices] = StrToNum(GetToken(string$, ",", 2));
	viewerz[numindices] = StrToNum(GetToken(string$, ",", 3));
	orientationx[numindices] = StrToNum(GetToken(string$, ",", 4));
	orientationy[numindices] = StrToNum(GetToken(string$, ",", 5));
	orientationz[numindices] = StrToNum(GetToken(string$, ",", 6));
	numindices++;		# increment number of indices
	}

# procedure called automatically for each frame
proc OnFrame () {
	if (index >= numindices) then index = 0;	# if at end of path, go back to
															# beginning of path
	local class POINT3D viewer, orientation;
	viewer.x = viewerx[index];					# viewer position
	viewer.y = viewery[index];
	viewer.z = viewerz[index];
	orientation.x = orientationx[index];	# viewer orientation (x = pitch, 
	orientation.y = orientationy[index];	# y = roll, z = heading azimuth
	orientation.z = orientationz[index];
	TNTsim3D.SetSceneByOrientation(viewer, orientation);		# set frame
	index++;			# increment current index
	}



Back Home ©MicroImages, Inc. 2013 Published in the United States of America
11th Floor - Sharp Tower, 206 South 13th Street, Lincoln NE 68508-2010   USA
Business & Sales: (402)477-9554  Support: (402)477-9562  Fax: (402)477-9559
Business info@microimages.com  Support support@microimages.com  Web webmaster@microimages.com

25 March 2009

page update: 26 May 11