Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

Location:
code/branches/ScriptableController/data
Files:
2 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
  • code/branches/ScriptableController/data/levels/levelTry.oxw

    r10059 r10065  
    4747    <SpawnPoint team=0 position="3200,0,0" lookat="2800,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
    4848
     49    <!--
    4950    <StaticEntity position  = "2800,0,0" mass=10000 collisionType=static >
    5051      <attached>
     
    5253      </attached>
    5354      <collisionShapes>
    54         <BoxCollisionShape  position="-560,0,0" halfExtents="115,100,245" /><!-- Three lower boxes -->
     55        <BoxCollisionShape  position="-560,0,0" halfExtents="115,100,245" />
    5556        <BoxCollisionShape  position="290,0,-480" halfExtents="115,100,245" yaw=-120 />
    5657        <BoxCollisionShape  position="290,0,480" halfExtents="115,100,245" yaw=-240 />
    57         <BoxCollisionShape  position="-280,0,0" halfExtents="163,50,50" /><!-- Three lower connections -->
     58        <BoxCollisionShape  position="-280,0,0" halfExtents="163,50,50" />
    5859        <BoxCollisionShape  position="140,0,-240" halfExtents="163,50,50" yaw=-120 />
    5960        <BoxCollisionShape  position="140,0,240" halfExtents="163,50,50" yaw=-240 />
    60         <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" /><!-- Upper Tower -->
     61        <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" />
    6162        <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" yaw=-120 />
    6263        <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" yaw=-240 />
    63         <BoxCollisionShape  position="0,400,0" halfExtents="43,110,26" yaw=-30 /><!-- Middle one-->
    64         <BoxCollisionShape  position="-200,100,0" halfExtents="26,50,43" /><!--Three lower legs -->
     64        <BoxCollisionShape  position="0,400,0" halfExtents="43,110,26" yaw=-30 />
     65        <BoxCollisionShape  position="-200,100,0" halfExtents="26,50,43" />
    6566        <BoxCollisionShape  position="100,100,-173" halfExtents="43,50,26" yaw=-30 />
    6667        <BoxCollisionShape  position="100,100,-173" halfExtents="43,50,26" yaw=30 />
    67         <BoxCollisionShape  position="-100,264,0" halfExtents="26,105,43" roll=-49 /><!--Three upper legs -->
     68        <BoxCollisionShape  position="-100,264,0" halfExtents="26,105,43" roll=-49 />
    6869        <BoxCollisionShape  position="50,264,-87" halfExtents="26,105,43" roll=-49 yaw=-120 />
    6970        <BoxCollisionShape  position="50,264,87" halfExtents="26,105,43" roll=-49 yaw=-240 />
    7071      </collisionShapes>
    7172    </StaticEntity>
     73    -->
    7274
    7375
     
    7779    />
    7880
     81    <StaticEntity position  = "0,0,0" mass=10000 collisionType=static >
     82      <attached>
     83        <Model mesh="HydroHarvester.mesh" mass=10 position="0,0,0" scale=10 />
     84      </attached>
     85    </StaticEntity>
     86
     87    <StaticEntity position  = "-1000,3000,-1000" mass=10000 collisionType=static >
     88      <attached>
     89        <Model mesh="HydroHarvester.mesh" mass=10 position="0,0,0" scale=80 />
     90      </attached>
     91    </StaticEntity>
    7992
    8093<!-- ControllerDirector waits for the event takeControl to attach a new Controller -->
     
    8497                <EventListener event="takeControl" />
    8598            </takeControl>
    86 
    8799        </events>
    88 
    89100    </ControllerDirector>
    90 
    91 <!-- -->
    92     <ScriptController position="0,0,1">
    93 
    94 
    95     </ScriptController>
    96 
    97101
    98102<!-- FPS Player as destination of the dock -->
Note: See TracChangeset for help on using the changeset viewer.