Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jul 12, 2004, 10:28:25 PM (21 years ago)
Author:
chris
Message:

orxonox/branches/chris: Implemented quaternion class… but something is still f up… the camera keeps pointing into the wrong direction… matrix rotation calculation seems not to be my strenght…

File:
1 edited

Legend:

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

    r2101 r2112  
    4242void Track::map_camera (Location* lookat, Placement* camplc)
    4343{
     44printf("Track|Mapping camera: %d (%f)\n", lookat->part, lookat->dist);
    4445        Line trace(*offset, *end - *offset);
    4546        float l = trace.len ();
    4647       
     48//      camplc->r = *offset + Vector(0,0,0.5);
     49//      camplc->w = Quaternion (trace.a, Vector(0,0,1));
     50       
    4751        camplc->r = trace.r + (trace.a * ((lookat->dist-10.0) / l)) + Vector(0,0,5.0);
    48         camplc->w = Rotation( (trace.r + (trace.a * ((lookat->dist) / l))) - camplc->r);
     52        camplc->w = Quaternion((trace.r + (trace.a * ((lookat->dist) / l)) - camplc->r), Vector(0,0,1));
     53       
    4954}
    5055
    5156bool Track::map_coords (Location* loc, Placement* plc)
    5257{
     58printf("Track|Mapping coords: %d (%f)\n", loc->part, loc->dist);
    5359        Line trace(*offset, *end - *offset);
    5460        float l = trace.len ();
     
    6167        }
    6268       
    63         Rotation dir(trace.a);
     69        Quaternion dir(trace.a, Vector(0,0,1));
    6470       
    65         plc->r = trace.r + (trace.a * ((loc->dist) / l)) + rotate_vector( loc->pos, dir);
     71        plc->r = trace.r + (trace.a * ((loc->dist) / l)) + dir.apply(loc->pos);
    6672        plc->w = dir * loc->rot;
    6773       
Note: See TracChangeset for help on using the changeset viewer.