Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8946


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

asteroidBelt function added

Location:
code/branches/environment3
Files:
3 edited

Legend:

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

    r8919 r8946  
    3737    <?lua
    3838        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)
    4041    ?>
    4142   
  • code/branches/environment3/data/levels/includes/asteroidField.lua

    r8919 r8946  
    1010        do
    1111                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
    1215                print("<StaticEntity ")
    1316               
    1417                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("\"")
    1821               
    1922                print("scale = \"") print(size) print("\"")
    2023               
    21                 print("collisionType = static linearDamping = 0.8 angularDamping = 0 collisiondamage = 1 enablecollisiondamage = true>")
     24                print("collisionType = static linearDamping = 0.8 angularDamping = 1 collisiondamage = 1000 enablecollisiondamage = true>")
    2225                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>")
    2528                print("</StaticEntity>")
    2629        end
     30end
     31
     32
     33--[[ asteroid belt generator
     34generates 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--]]
     41function 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
    2746       
     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>")
    2867end
  • code/branches/environment3/src/libraries/util/SignalHandler.cc

    r8919 r8946  
    7070
    7171      catchSignal( SIGSEGV );
    72 //      catchSignal( SIGABRT );
     72//      catchSignal( SIGABRT );  // CEGUI nasty bugfix
    7373      catchSignal( SIGILL );
    7474    }
     
    127127      if( SignalHandler::singletonPtr_s == 0 )
    128128      {
    129         orxout(user_error) << "Received signal(sigHandler already destroyed) " << sigName.c_str() << endl << "Can't write backtrace because SignalHandler is already destroyed" << endl;
     129        orxout(user_error) << "Received signal " << sigName.c_str() << endl << "Can't write backtrace because SignalHandler is already destroyed" << endl;
    130130        exit(EXIT_FAILURE);
    131131      }
     
    137137
    138138
    139       orxout(user_error) << "Received signal(second error) " << sigName.c_str() << endl << "Try to write backtrace to file orxonox_crash.log" << endl;
     139      orxout(user_error) << "Received signal " << sigName.c_str() << endl << "Try to write backtrace to file orxonox_crash.log" << endl;
    140140
    141141     
     
    675675
    676676    /// Returns a description of the given exception.
    677     // Based on code from Dr. Mingw by José Fonseca
     677    // Based on code from Dr. Mingw by Jos\E9 Fonseca
    678678    /* static */ std::string SignalHandler::getExceptionType(PEXCEPTION_POINTERS pExceptionInfo)
    679679    {
     
    745745
    746746    /// Retrieves the base address of the module that contains the specified address.
    747     // Code from Dr. Mingw by José Fonseca
     747    // Code from Dr. Mingw by Jos\E9 Fonseca
    748748    /* static */ DWORD SignalHandler::getModuleBase(DWORD dwAddress)
    749749    {
Note: See TracChangeset for help on using the changeset viewer.