[Orxonox-commit 4218] r8889 - in code/branches/environment3/data/levels: . includes
fmauro at orxonox.net
fmauro at orxonox.net
Wed Oct 12 16:01:31 CEST 2011
Author: fmauro
Date: 2011-10-12 16:01:30 +0200 (Wed, 12 Oct 2011)
New Revision: 8889
Added:
code/branches/environment3/data/levels/asteroidField.oxw
code/branches/environment3/data/levels/includes/asteroidField.lua
Log:
First implementation of asteroid field generator
Added: code/branches/environment3/data/levels/asteroidField.oxw
===================================================================
--- code/branches/environment3/data/levels/asteroidField.oxw (rev 0)
+++ code/branches/environment3/data/levels/asteroidField.oxw 2011-10-12 14:01:30 UTC (rev 8889)
@@ -0,0 +1,42 @@
+<LevelInfo
+ name = "asteroidFieldTest"
+ description = "Test of the asteroidField generator."
+ tags = "asteroidField"
+/>
+
+<?lua
+ include("stats.oxo")
+ include("HUDTemplates3.oxo")
+ include("templates/lodInformation.oxt")
+?>
+
+<?lua
+ include("templates/spaceshipAssff2.oxt")
+ include("templates/spaceshipPirate.oxt")
+?>
+
+<Level
+ name = "Sample"
+ description = "Just a few tests"
+>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+ <?lua include("includes/notifications.oxi") ?>
+
+ <Scene
+ ambientlight = "0.8, 0.8, 0.8"
+ skybox = "Orxonox/Starbox"
+ >
+
+ <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+ <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff2 />
+
+ <?lua
+ dofile("includes/asteroidField.lua")
+ asteroidField(0, 0, 0, 12000, 250)
+ ?>
+
+ </Scene>
+</Level>
+
Added: code/branches/environment3/data/levels/includes/asteroidField.lua
===================================================================
--- code/branches/environment3/data/levels/includes/asteroidField.lua (rev 0)
+++ code/branches/environment3/data/levels/includes/asteroidField.lua 2011-10-12 14:01:30 UTC (rev 8889)
@@ -0,0 +1,20 @@
+function asteroidField(posX,posY,posZ,radius,count)
+ for i = 1, count, 1
+ do
+ size = math.random()
+ print("<MovableEntity ")
+
+ print("position = \"")
+ print((2 * math.random() * radius) - radius + posX) print(",")
+ print((2 * math.random() * radius) - radius + posY) print(",")
+ print((2 * math.random() * radius) - radius + posZ) print("\"")
+
+ print("scale = \"") print(size * 150) print("\"")
+
+ print("collisionType = dynamic linearDamping = 0.8 angularDamping = 0 collisiondamage = 1 enablecollisiondamage = true>")
+ print("<attached> <Model mass=\"") print(size * 1000) print("\" mesh=\"ast") print(math.mod(i,6) + 1) print(".mesh\" /> </attached>")
+ print("<collisionShapes> <SphereCollisionShape radius=\"") print(size * 350) print("\" /> </collisionShapes>")
+ print("</MovableEntity>")
+ end
+
+end
More information about the Orxonox-commit
mailing list