Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2080 in orxonox.OLD for orxonox/branches/chris/src/track.cc


Ignore:
Timestamp:
Jul 6, 2004, 10:29:05 PM (21 years ago)
Author:
chris
Message:

orxonox/branches/chris: Implemented basic track and spawning functionality. Added a function to convert a Rotation into a glmatrix. Implemented operator* in Rotation. Refined World, made World friend class of world_entity. Implemented camera functionality (can now be bound to the worldentity it should focus on).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/chris/src/track.cc

    r2068 r2080  
    1212
    1313   ### File Specific:
    14    main-programmer: ...
     14   main-programmer: Christian Meyer
    1515   co-programmer: ...
    1616*/
     
    2121using namespace std;
    2222
    23 
    24 
    25 Track::Track ()
     23Track::Track (Uint32 number, Uint32 next, Vector* start, Vector* finish)
    2624{
     25        ID = number;
     26        offset = start;
     27        end = finish;
     28        nextID = next;
    2729}
    2830
     
    3335void Track::map_camera (Location* lookat, Placement* camplc)
    3436{
     37        Line trace(*offset, *end - *offset);
     38        float l = trace.len ();
     39       
     40        camplc->r = trace.r + (trace.a * ((lookat->dist-10.0) / l)) + Vector(0,0,5.0);
     41        camplc->w = Rotation( (trace.r + (trace.a * ((lookat->dist) / l))) - camplc->r);
    3542}
    3643
    37 void Track::map_coords (Location* loc, Placement* plc)
     44bool Track::map_coords (Location* loc, Placement* plc)
    3845{
     46        Line trace(*offset, *end - *offset);
     47        float l = trace.len ();
    3948       
     49        if( loc->dist > l)
     50        {
     51                loc->dist -= l;
     52                loc->part = nextID;
     53                return true;
     54        }
     55       
     56        Rotation dir(trace.a);
     57       
     58        plc->r = trace.r + (trace.a * ((loc->dist) / l)) + rotate_vector( loc->pos, dir);
     59        plc->w = dir * loc->rot;
     60       
     61        return false;
     62}
     63
     64void Track::post_enter (WorldEntity* entity)
     65{
     66}
     67
     68void Track::post_leave (WorldEntity* entity)
     69{
     70}
     71
     72void Track::tick (float deltaT)
     73{
    4074}
    4175
Note: See TracChangeset for help on using the changeset viewer.