Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 2, 2011, 3:35:23 PM (13 years ago)
Author:
fmauro
Message:

Added newtonian gravity to asteriods and comments

Location:
code/branches/environment3/data/levels
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/environment3/data/levels/asteroidField.oxw

    r8889 r8917  
    2828    ambientlight = "0.8, 0.8, 0.8"
    2929    skybox       = "Orxonox/Starbox"
     30    hasPhysics   = true
    3031  >
    3132
    3233    <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"/>
    3334    <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff2 />
    34    
     35
     36    <!-- Generate asteroid field with diameter 12000 containing 250 asteroids -->   
    3537    <?lua
    3638        dofile("includes/asteroidField.lua")
    37         asteroidField(0, 0, 0, 12000, 250)
     39        asteroidField(0, 0, 0, 150, 50,12000, 250)
    3840    ?>
    3941   
  • code/branches/environment3/data/levels/includes/asteroidField.lua

    r8889 r8917  
    1 function asteroidField(posX,posY,posZ,radius,count)
     1--[[ asteroid field generator
     2--[[
     3--[[ generates asteroid field
     4--[[ posX, posY, posZ - position in space
     5--[[ minSize, maxSize - size boundaries of each asteroid
     6--[[ radius - size of the cube around position in space
     7--[[ count - number of asteroids
     8function asteroidField(posX, posY, posZ, minSize, maxSize, radius, count)
    29        for i = 1, count, 1
    310        do
    4                 size = math.random()
    5                 print("<MovableEntity ")
     11                size = (math.random() * (maxSize - minSize)) + minSize
     12                print("<StaticEntity ")
    613               
    714                print("position = \"")
     
    1017                print((2 * math.random() * radius) - radius + posZ) print("\"")
    1118               
    12                 print("scale = \"") print(size * 150) print("\"")
     19                print("scale = \"") print(size) print("\"")
    1320               
    14                 print("collisionType = dynamic linearDamping = 0.8 angularDamping = 0 collisiondamage = 1 enablecollisiondamage = true>")
    15                 print("<attached> <Model mass=\"") print(size * 1000) print("\" mesh=\"ast") print(math.mod(i,6) + 1) print(".mesh\" /> </attached>")
    16                 print("<collisionShapes> <SphereCollisionShape radius=\"") print(size * 350) print("\" /> </collisionShapes>")
    17                 print("</MovableEntity>")
     21                print("collisionType = static linearDamping = 0.8 angularDamping = 0 collisiondamage = 1 enablecollisiondamage = true>")
     22                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>")
     25                print("</StaticEntity>")
    1826        end
    1927       
Note: See TracChangeset for help on using the changeset viewer.