Changeset 8946 for code/branches/environment3/data
- Timestamp:
- Nov 23, 2011, 3:13:31 PM (13 years ago)
- Location:
- code/branches/environment3/data/levels
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/environment3/data/levels/asteroidField.oxw
r8919 r8946 37 37 <?lua 38 38 dofile("includes/asteroidField.lua") 39 asteroidField(0, 0, 0, 150, 50, 12000, 250) 39 asteroidField(0, 0, 5000, 100, 150, 2000, 50); 40 asteroidBelt(0, 0, 0, -48, -34, 30, 100, 200, 17000, 21000, 900) 40 41 ?> 41 42 -
code/branches/environment3/data/levels/includes/asteroidField.lua
r8919 r8946 10 10 do 11 11 size = (math.random() * (maxSize - minSize)) + minSize 12 pX = (2 * math.random() * radius) - radius + posX 13 pY = (2 * math.random() * radius) - radius + posY 14 pZ = (2 * math.random() * radius) - radius + posZ 12 15 print("<StaticEntity ") 13 16 14 17 print("position = \"") 15 print( (2 * math.random() * radius) - radius + posX) print(",")16 print( (2 * math.random() * radius) - radius + posY) print(",")17 print( (2 * math.random() * radius) - radius + posZ) print("\"")18 print(pX) print(",") 19 print(pY) print(",") 20 print(pZ) print("\"") 18 21 19 22 print("scale = \"") print(size) print("\"") 20 23 21 print("collisionType = static linearDamping = 0.8 angularDamping = 0 collisiondamage = 1enablecollisiondamage = true>")24 print("collisionType = static linearDamping = 0.8 angularDamping = 1 collisiondamage = 1000 enablecollisiondamage = true>") 22 25 print("<attached> <Model mass=\"") print(size * 10) print("\" mesh=\"ast") print(math.mod(i,6) + 1) print(".mesh\" /> </attached>") 23 print("<attached> <ForceField position=\"0,0,0\" mode=\"newtonianGravity\" diameter=\"") print(size + (size * 0.2)) print("\" massDiameter=\"") print(size) print("\" mass=\"") print(size * 1000) print("\" /> </attached>")24 print("<collisionShapes> <SphereCollisionShape radius=\"") print(size ) print("\" /> </collisionShapes>")26 print("<attached> <ForceField position=\"0,0,0\" mode=\"newtonianGravity\" diameter=\"") print(size * 2.7) print("\" massDiameter=\"") print(size * 2) print("\" mass=\"") print(size * 1000) print("\" /> </attached>") 27 print("<collisionShapes> <SphereCollisionShape radius=\"") print(size*2.5) print("\" /> </collisionShapes>") 25 28 print("</StaticEntity>") 26 29 end 30 end 31 32 33 --[[ asteroid belt generator 34 generates asteroid belt 35 posX, posY, posZ - position in space 36 yaw, pitch - rotation 37 minSize, maxSize - size boundaries of each asteroid 38 radius0, radius1 - inner/outer radius 39 count - number of asteroids 40 --]] 41 function asteroidBelt(centerX, centerY, centerZ, yaw, pitch, segments, minSize, maxSize, radius0, radius1, count) 42 dPhi = (2 * math.pi) / segments 43 width = math.abs(radius1 - radius0) 44 radius = (radius1 + radius0) / 2 45 segmentCount = count / segments 27 46 47 print("<StaticEntity collisionType=static yaw=") 48 print(yaw) 49 print(" pitch=") 50 print(pitch) 51 print(" position = \"") 52 print(centerX) print(",") 53 print(centerY) print(",") 54 print(centerZ) print("\"") 55 print(">") 56 print("<attached>") 57 58 for i = 0, segments - 1, 1 59 do 60 asteroidField((radius * math.cos(i * dPhi)), 61 (radius * math.sin(i * dPhi)), 62 0, minSize, maxSize, width,segmentCount) 63 end 64 65 print("</attached>") 66 print("</StaticEntity>") 28 67 end
Note: See TracChangeset
for help on using the changeset viewer.