[Orxonox-commit 5955] r10614 - in code/branches/presentationFS15merge: . data/gui/scripts data/levels src/orxonox/controllers
landauf at orxonox.net
landauf at orxonox.net
Sun Oct 4 12:16:43 CEST 2015
Author: landauf
Date: 2015-10-04 12:16:42 +0200 (Sun, 04 Oct 2015)
New Revision: 10614
Added:
code/branches/presentationFS15merge/data/gui/scripts/presentation.lua
Modified:
code/branches/presentationFS15merge/
code/branches/presentationFS15merge/data/gui/scripts/testscript.lua
code/branches/presentationFS15merge/data/levels/scriptController.oxw
code/branches/presentationFS15merge/src/orxonox/controllers/ControllerDirector.cc
code/branches/presentationFS15merge/src/orxonox/controllers/ControllerDirector.h
code/branches/presentationFS15merge/src/orxonox/controllers/ScriptController.cc
code/branches/presentationFS15merge/src/orxonox/controllers/ScriptController.h
Log:
merged branch SciptableControllerFS15
Property changes on: code/branches/presentationFS15merge
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/ParticleEffectsFS15:10309-10612
/code/branches/Racingbot:9388-9513
/code/branches/ScriptableController:9999-10075
/code/branches/ai:6592-7033
/code/branches/ai2:8721-8880
/code/branches/bigships:8137-8588
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/clangenb:10385-10609
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/core6:9552-9666
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dockingsystem:8101-8192
/code/branches/dockingsystem2:8196-8560
/code/branches/dynamicmatch:6584-7030
/code/branches/environment3:8887-8975
/code/branches/formation:8885-8991
/code/branches/formationFS15:10320-10610
/code/branches/formationupdate:9580-9624
/code/branches/fps:6591-7072
/code/branches/gamecontent:8893-8968
/code/branches/gameimmersion:8102-8577
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hud:8883-8986
/code/branches/hudHS14:10083-10241
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/invaders:9694-9896
/code/branches/ipv6:7293-7458
/code/branches/keckslevelHS14:10082-10222
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/largeShip1:9384-9515
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/levelElias:9697-9921
/code/branches/levelKaan:9695-9921
/code/branches/levelMichael:9696-9921
/code/branches/leveljoemeHS14:10087-10223
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/libs:9668-9674
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/masterserverfix:8933-8936
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/menue:8884-8976
/code/branches/minigame4DHS14:10081-10230
/code/branches/miniprojects:2754-2824
/code/branches/modularships:9994-10071
/code/branches/multiplayerFS15:10324-10611
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/newlevel2012:9033-9244
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/output:8739-8857
/code/branches/overlay:2117-2385
/code/branches/pCuts:9023-9284
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup:8145-8555
/code/branches/pickup2:5942-6405
/code/branches/pickup2012:9029-9189
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/pickupsFS14:10000-10259
/code/branches/png2:7262-7263
/code/branches/portals:8087-8455
/code/branches/portals2:8460-8602
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786,8500-8705
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation2011:8974-9015
/code/branches/presentation2012:9189-9268
/code/branches/presentation2012merge:9266-9347
/code/branches/presentation3:6913-7162
/code/branches/presentationFS14:10069-10215
/code/branches/presentationHS12:9481-9525
/code/branches/presentationHS13:9891-9938
/code/branches/presentationHS14merge:10222-10257
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/radarDreiD:9690-9901
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/sfxThilo:9691-9917
/code/branches/shipSelection:9038-9206
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound2012:9205-9214
/code/branches/sound3:5941-6102
/code/branches/spaceNavigation:9381-9497
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/spacerace:8182-8630
/code/branches/spaceraceTwo:8881-8996
/code/branches/spacestationentry:9699-9905
/code/branches/steering:5949-6091,8140-8595
/code/branches/storymodeHS14:10085-10254
/code/branches/surfaceRace:9028-9199
/code/branches/surfaceraceHS14:10080-10236
/code/branches/testing:9015-9549
/code/branches/tetris:8100-8563
/code/branches/towerdefenseHS14:10086-10247
/code/branches/turret:9380-9501
/code/branches/turretFS14:9998-10070
/code/branches/tutoriallevel:7827-8370
/code/branches/tutoriallevel2:8370-8452
/code/branches/tutoriallevel3:8453-8636
/code/branches/unity_build:8440-8716
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890
/code/branches/weaponupdateHS14:10084-10237
+ /code/branches/ParticleEffectsFS15:10309-10612
/code/branches/Racingbot:9388-9513
/code/branches/SciptableControllerFS15:10308-10613
/code/branches/ScriptableController:9999-10075
/code/branches/ai:6592-7033
/code/branches/ai2:8721-8880
/code/branches/bigships:8137-8588
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/clangenb:10385-10609
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/core6:9552-9666
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dockingsystem:8101-8192
/code/branches/dockingsystem2:8196-8560
/code/branches/dynamicmatch:6584-7030
/code/branches/environment3:8887-8975
/code/branches/formation:8885-8991
/code/branches/formationFS15:10320-10610
/code/branches/formationupdate:9580-9624
/code/branches/fps:6591-7072
/code/branches/gamecontent:8893-8968
/code/branches/gameimmersion:8102-8577
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hud:8883-8986
/code/branches/hudHS14:10083-10241
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/invaders:9694-9896
/code/branches/ipv6:7293-7458
/code/branches/keckslevelHS14:10082-10222
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/largeShip1:9384-9515
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/levelElias:9697-9921
/code/branches/levelKaan:9695-9921
/code/branches/levelMichael:9696-9921
/code/branches/leveljoemeHS14:10087-10223
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/libs:9668-9674
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/masterserverfix:8933-8936
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/menue:8884-8976
/code/branches/minigame4DHS14:10081-10230
/code/branches/miniprojects:2754-2824
/code/branches/modularships:9994-10071
/code/branches/multiplayerFS15:10324-10611
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/newlevel2012:9033-9244
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/output:8739-8857
/code/branches/overlay:2117-2385
/code/branches/pCuts:9023-9284
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup:8145-8555
/code/branches/pickup2:5942-6405
/code/branches/pickup2012:9029-9189
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/pickupsFS14:10000-10259
/code/branches/png2:7262-7263
/code/branches/portals:8087-8455
/code/branches/portals2:8460-8602
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786,8500-8705
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation2011:8974-9015
/code/branches/presentation2012:9189-9268
/code/branches/presentation2012merge:9266-9347
/code/branches/presentation3:6913-7162
/code/branches/presentationFS14:10069-10215
/code/branches/presentationFS15:10499
/code/branches/presentationHS12:9481-9525
/code/branches/presentationHS13:9891-9938
/code/branches/presentationHS14merge:10222-10257
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/radarDreiD:9690-9901
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/sfxThilo:9691-9917
/code/branches/shipSelection:9038-9206
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound2012:9205-9214
/code/branches/sound3:5941-6102
/code/branches/spaceNavigation:9381-9497
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/spacerace:8182-8630
/code/branches/spaceraceTwo:8881-8996
/code/branches/spacestationentry:9699-9905
/code/branches/steering:5949-6091,8140-8595
/code/branches/storymodeHS14:10085-10254
/code/branches/surfaceRace:9028-9199
/code/branches/surfaceraceHS14:10080-10236
/code/branches/testing:9015-9549
/code/branches/tetris:8100-8563
/code/branches/towerdefenseHS14:10086-10247
/code/branches/turret:9380-9501
/code/branches/turretFS14:9998-10070
/code/branches/tutoriallevel:7827-8370
/code/branches/tutoriallevel2:8370-8452
/code/branches/tutoriallevel3:8453-8636
/code/branches/unity_build:8440-8716
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890
/code/branches/weaponupdateHS14:10084-10237
Copied: code/branches/presentationFS15merge/data/gui/scripts/presentation.lua (from rev 10613, code/branches/SciptableControllerFS15/data/gui/scripts/presentation.lua)
===================================================================
--- code/branches/presentationFS15merge/data/gui/scripts/presentation.lua (rev 0)
+++ code/branches/presentationFS15merge/data/gui/scripts/presentation.lua 2015-10-04 10:16:42 UTC (rev 10614)
@@ -0,0 +1,40 @@
+-- Set some test variables
+xm = 1000
+ym = 0
+zm = 0
+
+xl = -1000
+yl = 3000
+zl = -1000
+
+xr = 2000
+yr = 500
+zr = 2000
+
+d = 5
+Tabs = 0
+
+pi = 3.1415
+
+-- Get a local pointer to a scriptcontroller
+local ctrl = orxonox.ScriptController:getScriptController()
+
+-- If it worked, call its "movetoposition" function
+if ctrl ~= nil then
+
+ ctrl:eventScheduler("mal", xl,yl,zl, xl,yl,zl, 2)
+ ctrl:eventScheduler("idle", 1)
+ ctrl:eventScheduler("ral", xl, yl, zl, 3, 0, 0, math.pi)
+ ctrl:eventScheduler("idle", 1)
+ ctrl:eventScheduler("mal", 0,0,1000, xl,yl,zl, 3)
+ ctrl:eventScheduler("idle", 1)
+ ctrl:eventScheduler("chl", xl, yl, zl, xr, yr, zr, 2)
+ ctrl:eventScheduler("idle", 1)
+ ctrl:eventScheduler("mal", xr + 600,yr,zr, xr,yr,zr, 4)
+ ctrl:eventScheduler("idle", 1)
+ ctrl:eventScheduler("chl", xr, yr, zr, xl, yl, zl, 3)
+ ctrl:eventScheduler("idle", 1)
+ ctrl:eventScheduler("spi", xm,ym,zm, 0,0,0, 4)
+ ctrl:eventScheduler("idle", 1)
+
+end
\ No newline at end of file
Modified: code/branches/presentationFS15merge/data/gui/scripts/testscript.lua
===================================================================
--- code/branches/presentationFS15merge/data/gui/scripts/testscript.lua 2015-10-04 10:15:43 UTC (rev 10613)
+++ code/branches/presentationFS15merge/data/gui/scripts/testscript.lua 2015-10-04 10:16:42 UTC (rev 10614)
@@ -21,72 +21,20 @@
-- If it worked, call its "movetoposition" function
if ctrl ~= nil then
- -- Move to the starting point at (xl+3000,yl,zl) while looking
- -- at xl,yl,zl over the time span of 3 seconds
- ctrl:eventScheduler("mal", xl+3000,yl,zl, xl,yl,zl, 1, 0)
- -- From there, perform a rotation around the harvester placed there
- -- in 100 steps
- dt = math.pi/100
- for t = 0,math.pi,dt do
- xt = math.cos(t)
- yt = math.sin(t)
+ ctrl:eventScheduler("mal", xl,yl,zl, xl,yl,zl, 2)
+ ctrl:eventScheduler("idle", 1)
+ ctrl:eventScheduler("ral", xl, yl, zl, 3, 0, 0, math.pi)
+ ctrl:eventScheduler("idle", 1)
+ ctrl:eventScheduler("mal", 0,0,1000, xl,yl,zl, 3)
+ ctrl:eventScheduler("idle", 1)
+ ctrl:eventScheduler("chl", xl, yl, zl, xr, yr, zr, 2)
+ ctrl:eventScheduler("idle", 1)
+ ctrl:eventScheduler("mal", xr + 600,yr,zr, xr,yr,zr, 4)
+ ctrl:eventScheduler("idle", 1)
+ ctrl:eventScheduler("chl", xr, yr, zr, xl, yl, zl, 3)
+ ctrl:eventScheduler("idle", 1)
+ ctrl:eventScheduler("spi", xm,ym,zm, 0,0,0, 4)
+ ctrl:eventScheduler("idle", 600)
- ctrl:eventScheduler("mal", xl+3000*xt, yl+3000*yt, zl, xl, yl, zl, dt, t+0.9)
- end
-
-
- -- Update absolute time
- Tabs = math.pi + 0.9
-
-
-
- -- Move away again, still looking at the station
- ctrl:eventScheduler("mal", 0,0,1000, xl,yl,zl, 3, Tabs+0.4)
-
-
-
- -- Update absolute time
- Tabs = Tabs + 0.4 + 3
-
-
-
-
-
- -- Transition the look from (xl,yl,zl) to (3500,0,0) in 3 seconds
- ctrl:eventScheduler("chl", xl, yl, zl, xr, yr, zr, 2, Tabs+0.2)
-
- Tabs = Tabs + 2 + 0.2
-
- ctrl:eventScheduler("mal", xr + 600,yr,zr, xr,yr,zr, 4, Tabs+0)
-
- Tabs = Tabs + 4
-
- for t = 0,math.pi,dt do
- xt = math.cos(t)
- zt = math.sin(t)
-
- ctrl:eventScheduler("mal", xr+600*xt, yr, zr+600*zt, xr, yr, zr, dt, Tabs+t)
- end
-
- Tabs = Tabs + math.pi
-
- ctrl:eventScheduler("chl", xr, yr, zr, xl, yl, zl, 3, Tabs+0.2)
-
- Tabs = Tabs + 3 + 0.2
-
- ctrl:eventScheduler("mal", xm,ym,zm, xl,yl,zl, 4, Tabs+2.5)
-
-
-end
-
-
-
--- Output the newctrlid variable we set from the C++ code
-if newctrlid ~= nil then
- orxonox.execute("orxout message test " .. newctrlid)
-end
-
---orxonox.execute("setPause 1")
-
-
+end
\ No newline at end of file
Modified: code/branches/presentationFS15merge/data/levels/scriptController.oxw
===================================================================
--- code/branches/presentationFS15merge/data/levels/scriptController.oxw 2015-10-04 10:15:43 UTC (rev 10613)
+++ code/branches/presentationFS15merge/data/levels/scriptController.oxw 2015-10-04 10:16:42 UTC (rev 10614)
@@ -1,7 +1,7 @@
<!-- First levelFile of mkronig and samuezu. It was copied from dockingToASpaceStation.oxw and modified a little bit -->
<LevelInfo
- name = "Fancy orxout tests"
- description = "Docking into a spacestation."
+ name = "Scriptable Controller"
+ description = "Showcase for Scriptable Controller"
tags = "showcase"
screenshot = "emptylevel.png"
/>
@@ -10,17 +10,10 @@
include("stats.oxo")
include("HUDTemplates3.oxo")
include("templates/lodInformation.oxt")
- include("templates/pickupRepresentationTemplates.oxt")
?>
<?lua
- include("templates/spaceshipAssff.oxt")
- include("templates/spaceshipPirate.oxt")
include("templates/spaceshipEscort.oxt")
- include("templates/bigship.oxt")
- include("templates/spaceshipTurret.oxt")
- include("templates/spaceshipCollateralDamage.oxt")
- include("templates/FPS.oxt")
?>
<Level
@@ -39,160 +32,36 @@
hasPhysics = true
>
- <?lua
- include("includes/pickups.oxi")
- ?>
-
<Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0,1.0,1.0,0.5" specular="1.0, 0.9, 0.9, 1.0"/>
+
<SpawnPoint team=0 position="3200,0,0" lookat="2800,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
- <StaticEntity position = "2800,0,0" mass=10000 collisionType=static >
- <attached>
- <Model mesh="HydroHarvester.mesh" mass=10 position="0,0,0" scale=50 />
- </attached>
- <collisionShapes>
- <BoxCollisionShape position="-560,0,0" halfExtents="115,100,245" /><!-- Three lower boxes -->
- <BoxCollisionShape position="290,0,-480" halfExtents="115,100,245" yaw=-120 />
- <BoxCollisionShape position="290,0,480" halfExtents="115,100,245" yaw=-240 />
- <BoxCollisionShape position="-280,0,0" halfExtents="163,50,50" /><!-- Three lower connections -->
- <BoxCollisionShape position="140,0,-240" halfExtents="163,50,50" yaw=-120 />
- <BoxCollisionShape position="140,0,240" halfExtents="163,50,50" yaw=-240 />
- <BoxCollisionShape position="0,530,0" halfExtents="172,52,298" /><!-- Upper Tower -->
- <BoxCollisionShape position="0,530,0" halfExtents="172,52,298" yaw=-120 />
- <BoxCollisionShape position="0,530,0" halfExtents="172,52,298" yaw=-240 />
- <BoxCollisionShape position="0,400,0" halfExtents="43,110,26" yaw=-30 /><!-- Middle one-->
- <BoxCollisionShape position="-200,100,0" halfExtents="26,50,43" /><!--Three lower legs -->
- <BoxCollisionShape position="100,100,-173" halfExtents="43,50,26" yaw=-30 />
- <BoxCollisionShape position="100,100,-173" halfExtents="43,50,26" yaw=30 />
- <BoxCollisionShape position="-100,264,0" halfExtents="26,105,43" roll=-49 /><!--Three upper legs -->
- <BoxCollisionShape position="50,264,-87" halfExtents="26,105,43" roll=-49 yaw=-120 />
- <BoxCollisionShape position="50,264,87" halfExtents="26,105,43" roll=-49 yaw=-240 />
- </collisionShapes>
- </StaticEntity>
-
-<!-- Docking -->
- <Dock position="2830,20,50" roll=0 yaw=0 >
- <animations>
- <MoveToDockingTarget target="destroyer" />
- </animations>
- <effects>
- <DockToShip target="spaceShip" />
- </effects>
- <events>
- <execute>
- <EventListener event="dockMe" />
- </execute>
-
- <undocking>
- <EventListener event="undockMe" />
- </undocking>
-
- <activity>
- <EventListener event=notGameEnd />
- </activity>
- </events>
- <attached>
- <!-- Trigger for docking with billboard -->
-
- <!-- removed -->
-
- <!-- Trigger for undocking with billboard -->
- <!-- <Billboard position="-2630,-19970,150" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=1 /> -->
- <DistanceTrigger position="-2630,-19970,150" distance="50" target="Pawn"
- beaconMode="identify" targetname="bcnDestroyer" name="undockMe"
- />
- </attached>
- </Dock>
-
- <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=100 />
- <DistanceTrigger position="0,0,0" distance="200" target="Pawn"
- beaconMode="exclude" targetname="bcnDestroyer" name="dockMe"
+ <Billboard position="2500,0,0" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=10 />
+ <DistanceTrigger position="2500,0,0" distance="200" target="Pawn"
+ beaconMode="exclude" targetname="bcnDestroyer" name="takeControl"
/>
-
-<!-- Object, which orxouts the message "hello Universe!". EVENT NOT WORKING -->
- <ScriptController position="0,0,0">
- <events>
- <party>
- <EventListener event="dockMe" />
- </party>
-
- </events>
-
- </ScriptController>
-
-
-<!-- FPS Player as destination of the dock -->
-<FpsPlayer template = "fps" radarname = "First Person Player" position = "0,-19900,0" >
+ <StaticEntity position = "2000,500,2000" mass=10000 collisionType=static >
<attached>
- <DockingTarget name="spaceShip" />
- <DistanceTriggerBeacon name="bcnDestroyer" />
- <DockingTarget name="destroyer" />
+ <Model mesh="HydroHarvester.mesh" mass=10 position="0,0,0" scale=10 />
</attached>
-</FpsPlayer>
+ </StaticEntity>
-
-<!-- Cube as test SpaceStation
-
-The station can either be hidden outside of the skybox, within the hull of the space station if it is big enough or within a planet.
-Complex spacestations can be placed very far away from the spaceship so it is rendered at low resolution while the player uses the space ship.
-
--->
- <StaticEntity position="0,-20000,0" direction="0,-1,0" collisionType=static mass=100000 friction=0.01 >
+ <StaticEntity position = "-1000,3000,-1000" mass=10000 collisionType=static >
<attached>
- <Model position="0,0,0" mesh="crate.mesh" scale3D="80,80,5" />
+ <Model mesh="HydroHarvester.mesh" mass=10 position="0,0,0" scale=80 />
</attached>
- <collisionShapes>
- <BoxCollisionShape position="0,0,0" halfExtents="400,400,25" />
- </collisionShapes>
- </StaticEntity>
+ </StaticEntity>
-<!-- Homogenous gravitationfield to simulate local gravity (activating the normal gravity will affect the spaceship terribly) -->
-<ForceField position="0,-20000,0" mode="homogen" diameter="2000" forcedirection = "0,-500,0" />
+<!-- ControllerDirector waits for the event takeControl to attach a new Controller -->
+ <ControllerDirector position="0,0,0" scriptname="presentation">
+ <events>
+ <takeControl>
+ <EventListener event="takeControl" />
+ </takeControl>
+ </events>
+ </ControllerDirector>
-
-<!-- Some more stuff -->
-
- <!-- triple large belt around the planet -->
- <?lua
- dofile("includes/asteroidField.lua")
- asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 7190, 7800, 250, 1)
- ?>
- <?lua
- dofile("includes/asteroidField.lua")
- asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 10000, 11000, 300, 1)
- ?>
- <?lua
- dofile("includes/asteroidField.lua")
- asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 14000, 15000, 350, 1)
- ?>
-
- <Planet
- position="15000,0,-1000"
- scale="5000"
- collisionType="dynamic"
- linearDamping="0.8"
- angularDamping="0"
- mass="10000000"
- pitch="0"
- mesh="planets/ganymede.mesh"
- atmosphere="atmosphere1"
- rotationaxis="1,0,0"
- rotationrate="1.0"
- atmospheresize="80.0f"
- imagesize="1024.0f"
- collisiondamage = 2
- enablecollisiondamage = true
- >
- <attached>
- <ForceField position="5000,0,0" mode="sphere" diameter="10000" velocity="-50" />
- </attached>
- <collisionShapes>
- <SphereCollisionShape radius="5000" position="0,0,0" />
- </collisionShapes>
- </Planet>
-
</Scene>
-
</Level>
Modified: code/branches/presentationFS15merge/src/orxonox/controllers/ControllerDirector.cc
===================================================================
--- code/branches/presentationFS15merge/src/orxonox/controllers/ControllerDirector.cc 2015-10-04 10:15:43 UTC (rev 10613)
+++ code/branches/presentationFS15merge/src/orxonox/controllers/ControllerDirector.cc 2015-10-04 10:16:42 UTC (rev 10614)
@@ -40,6 +40,7 @@
void ControllerDirector::XMLPort(Element& xmlelement, XMLPort::Mode mode)
{
SUPER(ControllerDirector, XMLPort, xmlelement, mode);
+ XMLPortParam(ControllerDirector, "scriptname", setScriptName, getScriptName, xmlelement, mode).defaultValues("testscript");
orxout(verbose)<< "ControllerDirector::XMLPort "
<< "An instance of ControllerDirector has been created." << endl;
@@ -82,7 +83,7 @@
}
else
return;
-
+
/* Set up a luastate to use for running the scripts */
LuaState * ls = new LuaState();
@@ -97,9 +98,9 @@
/* Now run the script on this controller. This will still have the above
* variable "newctrlid" defined, which means it can make use of it.
*/
+ std::string scr = this->scriptname_ + ".lua";
+ ls->doFile(scr);
- ls->doFile("testscript.lua");
-
/* Increase the controller ID so we have a different one for
* the next time it is triggered */
ctrlid += 1;
Modified: code/branches/presentationFS15merge/src/orxonox/controllers/ControllerDirector.h
===================================================================
--- code/branches/presentationFS15merge/src/orxonox/controllers/ControllerDirector.h 2015-10-04 10:15:43 UTC (rev 10613)
+++ code/branches/presentationFS15merge/src/orxonox/controllers/ControllerDirector.h 2015-10-04 10:16:42 UTC (rev 10614)
@@ -46,7 +46,10 @@
bool party(bool bTriggered, BaseObject* trigger);
virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
+ inline void setScriptName(const std::string& name) { this->scriptname_ = name; }
+ inline const std::string& getScriptName() const { return this->scriptname_; }
+
/* Take over control of a given object */
void takeControl(Controller * controller, BaseObject * trigger);
bool preparationToTakeControl(BaseObject * trigger);
@@ -54,7 +57,8 @@
// currently unused
//void setNewController(Controller * controller);
- private:
+ protected:
+ std::string scriptname_;
PlayerInfo* player_;
ControllableEntity* entity_;
PlayerTrigger * pTrigger_;
Modified: code/branches/presentationFS15merge/src/orxonox/controllers/ScriptController.cc
===================================================================
--- code/branches/presentationFS15merge/src/orxonox/controllers/ScriptController.cc 2015-10-04 10:15:43 UTC (rev 10613)
+++ code/branches/presentationFS15merge/src/orxonox/controllers/ScriptController.cc 2015-10-04 10:16:42 UTC (rev 10614)
@@ -20,19 +20,35 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabian 'x3n' Landau
+ * ...
* Co-authors:
* ...
*
*/
+ /*
+ * Currently available lua commands:
+ *
+ * IMPORTANT: ALL COMMANDS DO REQUIRE 7 PARAMETERS TO BE PROVIDED. FILL UP WITH ZEROES IN UNIMPORTANT PLACES.
+ *
+ * Command | Abbreviation | Parameter 1 | '' 2 | '' 3 | '' 4 | '' 5 | '' 6 | '' 7
+ *
+ * "Move And Look" | mal | GoTo X Coordinate | '' Y '' | '' Z '' | LookAt X Coordinate | '' Y '' | '' Y '' | Duration
+ * "Rotate And Look" | ral | GoTo X Coordinate | '' Y '' | '' Z '' | Axis (1=x, 2=z, 3=z) | - | - | Duration
+ * "Spiral" | spi | GoTo X Coordinate | '' Y '' | '' Z '' | - | - | - | Duration
+ * "Transition Look" | chl | From X Coordinate | '' Y '' | '' Z '' | To X Coordinate | '' Y '' | '' Y '' | Duration
+ * "Idle (Do nothing)" | idle | Duration
+ */
+
#include "ScriptController.h"
#include "infos/PlayerInfo.h"
#include "core/CoreIncludes.h"
#include "worldentities/ControllableEntity.h"
#include "core/LuaState.h"
+#include "core/LuaState.h"
#include <cmath>
+
namespace orxonox
{
RegisterClass(ScriptController);
@@ -65,6 +81,9 @@
/* - Counters */
this->eventno = 0;
+ /* - First "previous event" scheduled at t=0 */
+ /* - Needed for automatically updating event times */
+ this->prevEventTime = 0;
}
void ScriptController::takeControl(int ctrlid)
@@ -177,24 +196,72 @@
}
/* Get a variable that specifies how far along the trajectory
- * we are
+ * we are currently.
*/
float dl = eventTime / currentEvent.duration;
- /* Depending */
+ /* Depending on command */
/* Do some moving */
if( this->processing )
- {
- if( this->currentEvent.fctName == "mal" )
+ {
+ // Abbreviation for "spiral" (rotation + translation)
+ if (this->currentEvent.fctName == "spi") {
+
+ // Need to know a perpendicular basis to the translation vector:
+ // Given (a, b, c) we chose (b, -a, 0)norm and (0, c, -b)norm
+ // Currently we set a fix rotational radius of 400
+ // TODO: Add an option to adjust radius of spiral movement
+ Vector3 direction = this->currentEvent.v1 - startpos;
+
+ Vector3* ortho1 = new Vector3(direction.y, -direction.x, 0);
+ float absOrtho1 = sqrt(direction.y * direction.y + direction.x * direction.x);
+ *ortho1 = 400 * cos(2 * M_PI * dl) * (*ortho1)/absOrtho1;
+
+ Vector3* ortho2 = new Vector3(0, direction.z, -direction.y);
+ float absOrtho2 = sqrt(direction.y * direction.y + direction.z * direction.z);
+ *ortho2 = 400 * sin(2 * M_PI * dl) * (*ortho2)/absOrtho2;
+
+ this->entity_->setPosition( (1-dl)*startpos + dl * this->currentEvent.v1 + *ortho1 + *ortho2);
+
+ delete ortho1;
+ delete ortho2;
+ }
+
+ // Abbreviation for "rotate and look"
+ if (this->currentEvent.fctName == "ral")
+ {
+ // Specify the axis
+ Vector3* a;
+ switch ((int) currentEvent.d) {
+ case 3:
+ a = new Vector3(this->currentEvent.v1.x + this->currentEvent.e*cos(2*M_PI*dl),
+ this->currentEvent.v1.y + this->currentEvent.e*sin(2*M_PI*dl),
+ this->currentEvent.v1.z);
+ break;
+ case 2:
+ a = new Vector3(this->currentEvent.v1.x + this->currentEvent.e*sin(2*M_PI*dl),
+ this->currentEvent.v1.y,
+ this->currentEvent.v1.z + this->currentEvent.e*cos(2*M_PI*dl));
+ break;
+ case 1:
+ a = new Vector3(this->currentEvent.v1.x,
+ this->currentEvent.v1.y + this->currentEvent.e*sin(2*M_PI*dl),
+ this->currentEvent.v1.z + this->currentEvent.e*cos(2*M_PI*dl));
+ break;
+ }
+
+ this->entity_->setPosition(*a);
+
+ /* Look at the specified position */
+ this->entity_->lookAt(this->currentEvent.v1);
+ }
+ else if( this->currentEvent.fctName == "mal" )
{
/* Set the position to the correct place in the trajectory */
this->entity_->setPosition( (1-dl)*startpos + dl * this->currentEvent.v1);
/* Look at the specified position */
this->entity_->lookAt(this->currentEvent.v2);
-
- /* Update look at position */
- //this->lookAtPosition = this->currentEvent.v2;
}
else if( this->currentEvent.fctName == "chl" )
{
@@ -223,14 +290,33 @@
/* Fill the structure with all the provided information */
tmp.fctName = instruction;
+
//tmp.x1 = x1; tmp.y1 = y1; tmp.z1 = z1;
//tmp.x2 = x2; tmp.y2 = y2; tmp.z2 = z2;
tmp.v1 = Vector3(x1,y1,z1);
tmp.v2 = Vector3(x2,y2,z2);
+
+ // the parameters are not required to be vector coordinates!
+ // for convenience they are however stored twice if they have some kind of different meaning
+ tmp.a = x1;
+ tmp.b = y1;
+ tmp.c = z1;
+ tmp.d = x2;
+ tmp.e = y2;
+ tmp.f = z2;
+
tmp.duration = duration;
- tmp.eventTime = executionTime;
- orxout(verbose) << tmp.fctName << endl;
+ /* This is kind of a hack. If we hit the function idle all we want to do is
+ advance event execution time, not schedule anything */
+ if (instruction == "idle") {
+ tmp.eventTime = this->prevEventTime;
+ this->prevEventTime += x1;
+ return;
+ } else {
+ tmp.eventTime = this->prevEventTime;
+ this->prevEventTime += duration;
+ }
/* Add the created event to the event list */
if(eventList.size()==0)
Modified: code/branches/presentationFS15merge/src/orxonox/controllers/ScriptController.h
===================================================================
--- code/branches/presentationFS15merge/src/orxonox/controllers/ScriptController.h 2015-10-04 10:15:43 UTC (rev 10613)
+++ code/branches/presentationFS15merge/src/orxonox/controllers/ScriptController.h 2015-10-04 10:16:42 UTC (rev 10614)
@@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabian 'x3n' Landau
+ * ...
* Co-authors:
* ...
*
@@ -44,9 +44,15 @@
/** Instruction for this event */
std::string fctName;
+ /** Final position we want to be at **/
Vector3 v1;
+
+ /** Where we are looking **/
Vector3 v2;
+ /** The parameters are additionally stored as a set of 6 numerical values **/
+ float a, b, c, d, e, f;
+
/** Time span of the event */
float duration;
@@ -68,10 +74,10 @@
// LUA interface
// tolua_begin
- void eventScheduler(std::string instruction,
- float x1, float y1, float z1,
- float x2, float y2, float z2,
- float duration, float executionTime);
+ void eventScheduler(std::string instruction = "",
+ float x1 = 0, float y1 = 0, float z1 = 0,
+ float x2 = 0, float y2 = 0, float z2 = 0,
+ float duration = 0, float executionTime = 0);
static ScriptController* getScriptController();
@@ -115,6 +121,9 @@
float eventTime;
Vector3 startpos;
+ /* Time of the previously scheduled event */
+ float prevEventTime;
+
/* - Position to look at during that transition */
//Vector3 lookAtPosition;
More information about the Orxonox-commit
mailing list