Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 21, 2014, 2:32:41 PM (10 years ago)
Author:
smerkli
Message:

Improved controller, "move and look" is now scriptable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ScriptableController/data/gui/scripts/testscript.lua

    r10057 r10065  
    1 --k = 1.2
     1-- Set some test variables
     2xm = 1000
     3ym = 0
     4zm = 0
    25
    3 --orxonox.execute("orxout message test " .. k)
     6xl = -1000
     7yl = 3000
     8zl = -1000
    49
    5 -- Set some test variables
    6 x = 1.1
    7 y = 2.2
    8 z = 3.3
     10d = 5
     11Tabs = 0
    912
    10 --os.execute("sleep " .. 2)
     13pi = 3.1415
    1114
    1215-- Get a local pointer to a scriptcontroller
     
    1518-- If it worked, call its "movetoposition" function
    1619if ctrl ~= nil then
    17   ctrl:eventScheduler("moveToPosition_beta", x, y, z, 0.01)
     20  -- Move to the starting point at (xl+3000,yl,zl) while looking
     21  -- at xl,yl,zl over the time span of 3 seconds
     22  ctrl:eventScheduler("mal", xl+3000,yl,zl, xl,yl,zl, 3, 0)
     23
     24  -- From there, perform a rotation around the harvester placed there
     25  -- in 100 steps
     26  dt = math.pi/100
     27  for t = 0,math.pi,dt do
     28    xt = math.cos(t)
     29    yt = math.sin(t)
     30
     31    ctrl:eventScheduler("mal", xl+3000*xt, yl+3000*yt, zl, xl, yl, zl, 3*dt, 3*t+2.9)
     32  end
     33
     34  -- Update absolute time
     35  Tabs = 3*math.pi + 2.9
     36
     37  -- Move away again, still looking at the station
     38  ctrl:eventScheduler("mal", 0,0,1000, xl,yl,zl, 3, Tabs+0.4)
     39
     40
    1841end
    1942
Note: See TracChangeset for help on using the changeset viewer.