Changeset 4438 in orxonox.OLD for orxonox/trunk/src/lib/coord
- Timestamp:
- Jun 1, 2005, 8:15:59 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/coord/pilot_node.cc
r4424 r4438 34 34 this->setClassID(CL_PILOT_PARENT, "PilotNode"); 35 35 36 travelSpeed = 60.0;36 travelSpeed = 30.0; 37 37 velocity = new Vector(); 38 38 bUp = bDown = bLeft = bRight = false; … … 66 66 /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */ 67 67 /* calculate the direction in which the craft is heading */ 68 Vector direction (1.0, 0.0, 0.0);68 //Vector direction (1.0, 0.0, 0.0); 69 69 //direction = this->absDirection.apply (direction); 70 Vector orthDirection (0.0, 0.0, 1.0);70 //Vector orthDirection (0.0, 0.0, 1.0); 71 71 //orthDirection = orthDirection.cross (direction); 72 72 73 if( this->bUp) 74 accel = accel+(direction*acceleration); 75 if( this->bDown) 76 accel = accel -(direction*acceleration); 77 if( this->bLeft) 78 accel = accel - (orthDirection*acceleration); 79 if( this->bRight) 80 accel = accel + (orthDirection*acceleration); 73 Quaternion q = this->getAbsDir(); 74 Vector direction(1,0,0); 75 direction = q.apply(direction); 81 76 82 Vector move = accel * time; 83 this->shiftCoor (move); 77 84 78 85 Quaternion q1(M_PI/4 * this->pitch/400.0, Vector(1,0,0)); 86 this->shiftDir(q1); 79 Vector orthDirection(0,0,1); 80 orthDirection = q.apply(orthDirection); 81 82 if( this->bUp) 83 accel = accel+(direction*acceleration); 84 if( this->bDown) 85 accel = accel -(direction*acceleration); 86 if( this->bLeft) 87 accel = accel - (orthDirection*acceleration); 88 if( this->bRight) 89 accel = accel + (orthDirection*acceleration); 90 91 Vector move = accel * time; 92 this->shiftCoor (move); 93 94 Quaternion q1(-M_PI/4 * this->roll/40000.0, Vector(0,0,1)); 95 Quaternion q2(-M_PI/4 * this->pitch/30000.0, Vector(0,1,0)); 96 //this->shiftDir(q1*q2); 97 this->shiftDir(q1*q2); 87 98 } 88 99 … … 108 119 else if( event.type == EV_MOUSE_MOTION) 109 120 { 110 PRINTF(0)("Mouse moved by %d,%d to (%d,%d)\n", event.xRel, event.yRel,111 event.x, event.y);112 121 this->pitch = event.x - 400; 113 122 this->roll = event.y - 300;
Note: See TracChangeset
for help on using the changeset viewer.