Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/chris/src/track.cc @ 2105

Last change on this file since 2105 was 2101, checked in by chris, 21 years ago

orxonox/branches/chris: Finished the "GETITTOCOMPILE" project… compiling should work now, but linking is a different story

File size: 1.4 KB
RevLine 
[2068]1
2
3/*
4   orxonox - the future of 3D-vertical-scrollers
5
6   Copyright (C) 2004 orx
7
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 2, or (at your option)
11   any later version.
12
13   ### File Specific:
[2080]14   main-programmer: Christian Meyer
[2068]15   co-programmer: ...
16*/
17
18#include "track.h"
19
20using namespace std;
21
[2101]22Track::Track ()
23{
24        ID = 0;
25        offset = NULL;
26        end = NULL;
27        nextID = 0;
28}
29
[2080]30Track::Track (Uint32 number, Uint32 next, Vector* start, Vector* finish)
[2068]31{
[2080]32        ID = number;
33        offset = start;
34        end = finish;
35        nextID = next;
[2068]36}
37
38Track::~Track ()
39{
40}
41
42void Track::map_camera (Location* lookat, Placement* camplc)
43{
[2080]44        Line trace(*offset, *end - *offset);
45        float l = trace.len ();
46       
47        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);
[2068]49}
50
[2080]51bool Track::map_coords (Location* loc, Placement* plc)
[2068]52{
[2080]53        Line trace(*offset, *end - *offset);
54        float l = trace.len ();
[2068]55       
[2080]56        if( loc->dist > l)
57        {
58                loc->dist -= l;
59                loc->part = nextID;
60                return true;
61        }
62       
63        Rotation dir(trace.a);
64       
65        plc->r = trace.r + (trace.a * ((loc->dist) / l)) + rotate_vector( loc->pos, dir);
66        plc->w = dir * loc->rot;
67       
68        return false;
[2068]69}
70
[2080]71void Track::post_enter (WorldEntity* entity)
72{
73}
[2068]74
[2080]75void Track::post_leave (WorldEntity* entity)
76{
77}
[2068]78
[2080]79void Track::tick (float deltaT)
80{
81}
[2068]82
83
[2080]84
85
86
Note: See TracBrowser for help on using the repository browser.