Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/data/gui/scripts/testscript.lua @ 10253

Last change on this file since 10253 was 10216, checked in by landauf, 10 years ago

merged branch presentationFS14 back to trunk

File size: 1.7 KB
RevLine 
[10065]1-- Set some test variables
2xm = 1000 
3ym = 0
4zm = 0
[10035]5
[10065]6xl = -1000 
7yl = 3000 
8zl = -1000
[10035]9
[10075]10xr = 2000
11yr = 500
12zr = 2000
13
[10065]14d = 5
15Tabs = 0
[10035]16
[10065]17pi = 3.1415
[10037]18
[10047]19-- Get a local pointer to a scriptcontroller
[10045]20local ctrl = orxonox.ScriptController:getScriptController()
[10047]21
22-- If it worked, call its "movetoposition" function
[10046]23if ctrl ~= nil then
[10065]24  -- Move to the starting point at (xl+3000,yl,zl) while looking
25  -- at xl,yl,zl over the time span of 3 seconds
[10066]26  ctrl:eventScheduler("mal", xl+3000,yl,zl, xl,yl,zl, 1, 0)
[10065]27
28  -- From there, perform a rotation around the harvester placed there
29  -- in 100 steps
30  dt = math.pi/100
31  for t = 0,math.pi,dt do
32    xt = math.cos(t)
33    yt = math.sin(t)
34
[10066]35    ctrl:eventScheduler("mal", xl+3000*xt, yl+3000*yt, zl, xl, yl, zl, dt, t+0.9)
[10065]36  end
37
[10075]38
[10065]39  -- Update absolute time
[10066]40  Tabs = math.pi + 0.9
[10065]41
[10075]42 
43
[10065]44  -- Move away again, still looking at the station
45  ctrl:eventScheduler("mal", 0,0,1000, xl,yl,zl, 3, Tabs+0.4)
46
[10075]47
48
[10066]49  -- Update absolute time
50  Tabs = Tabs + 0.4 + 3
[10065]51
[10075]52 
53
54 
55
[10066]56  -- Transition the look from (xl,yl,zl) to (3500,0,0) in 3 seconds
[10075]57  ctrl:eventScheduler("chl", xl, yl, zl, xr, yr, zr, 2, Tabs+0.2)
[10066]58
[10075]59  Tabs = Tabs + 2 + 0.2
60
61   ctrl:eventScheduler("mal", xr + 600,yr,zr, xr,yr,zr, 4, Tabs+0)
62
63   Tabs = Tabs + 4 
64
65  for t = 0,math.pi,dt do
66    xt = math.cos(t)
67    zt = math.sin(t)
68
69    ctrl:eventScheduler("mal", xr+600*xt, yr, zr+600*zt, xr, yr, zr, dt, Tabs+t)
70  end
71
72  Tabs = Tabs + math.pi
73
74  ctrl:eventScheduler("chl", xr, yr, zr, xl, yl, zl, 3, Tabs+0.2)
75
76  Tabs = Tabs + 3 + 0.2
77
78  ctrl:eventScheduler("mal", xm,ym,zm, xl,yl,zl, 4, Tabs+2.5)
79
80
[10046]81end
82
[10057]83
84
[10047]85-- Output the newctrlid variable we set from the C++ code
[10046]86if newctrlid ~= nil then
87  orxonox.execute("orxout message test " .. newctrlid)
88end
[10037]89
[10045]90--orxonox.execute("setPause 1")
[10037]91
[10045]92
Note: See TracBrowser for help on using the repository browser.