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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.