Changeset 391 for code/branches/steering
- Timestamp:
- Dec 5, 2007, 2:41:14 PM (17 years ago)
- Location:
- code/branches/steering/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/steering/src/orxonox.cc
r317 r391 85 85 : mKeyboard(keyboard), mMouse(mouse) 86 86 { 87 speed = 250; 88 loop = 100; 87 speed = 2500; 89 88 rotate = 10; 89 loop = 400; 90 90 mouseX = 0; 91 91 mouseY = 0; … … 93 93 minMouseX = 0; 94 94 moved = false; 95 steering->brakeRotate(rotate* 10);95 steering->brakeRotate(rotate*5); 96 96 steering->brakeLoop(loop); 97 97 mMouse->setEventCallback(this); … … 117 117 else 118 118 steering->loopLeft(0); 119 119 /* 120 120 if(moved) { 121 121 if (mouseY<0) … … 130 130 } 131 131 else { 132 steering->rotateUp(0); 133 steering->rotateDown(0); 134 steering->rotateRight(0); 135 steering->rotateLeft(0); 136 } 137 138 steering->tick(evt.timeSinceLastFrame); 139 // scenemanager->spacehip->tick(evt.timesincelastframe); 140 if(mKeyboard->isKeyDown(OIS::KC_ESCAPE)) 141 cout << "maximal MouseX: " << maxMouseX << "\tminMouseX: " << minMouseX << endl; 142 return !mKeyboard->isKeyDown(OIS::KC_ESCAPE); 143 } 144 145 bool mouseMoved(const OIS::MouseEvent &e) 146 { 147 mouseX = e.state.X.rel; 148 mouseY = e.state.Y.rel; 149 if(mouseX>maxMouseX) maxMouseX = mouseX; 150 if(mouseX<minMouseX) minMouseX = mouseX; 151 cout << "mouseX: " << mouseX << "\tmouseY: " << mouseY << endl; 152 moved = true; 153 return true; 154 } 132 */ 133 if(moved) { 134 if (mouseY<0) 135 steering->rotateUp(-mouseY*rotate); 136 if (mouseY>0) 137 steering->rotateDown(mouseY*rotate); 138 if (mouseX>0) 139 steering->rotateRight(mouseX*rotate); 140 if (mouseX<0) 141 steering->rotateLeft(-mouseX*rotate); 142 moved = false; 143 } 144 else { 145 steering->rotateUp(0); 146 steering->rotateDown(0); 147 steering->rotateRight(0); 148 steering->rotateLeft(0); 149 } 150 151 steering->tick(evt.timeSinceLastFrame); 152 // scenemanager->spacehip->tick(evt.timesincelastframe); 153 if(mKeyboard->isKeyDown(OIS::KC_ESCAPE)) 154 cout << "maximal MouseX: " << maxMouseX << "\tminMouseX: " << minMouseX << endl; 155 return !mKeyboard->isKeyDown(OIS::KC_ESCAPE); 156 } 157 158 bool mouseMoved(const OIS::MouseEvent &e) 159 { 160 mouseX = e.state.X.rel; 161 mouseY = e.state.Y.rel; 162 if(mouseX>maxMouseX) maxMouseX = mouseX; 163 if(mouseX<minMouseX) minMouseX = mouseX; 164 cout << "mouseX: " << mouseX << "\tmouseY: " << mouseY << endl; 165 moved = true; 166 return true; 167 } 155 168 156 169 bool mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id) { return true; } … … 303 316 node5->attachObject(head5); 304 317 305 steering = new SpaceshipSteering(500 , 200, 200, 200);318 steering = new SpaceshipSteering(5000, 50, 50, 150); 306 319 steering->addNode(node); 307 320 -
code/branches/steering/src/spaceship_steering.cc
r317 r391 67 67 if(speedRotateUpDown_ < 0) 68 68 speedRotateUpDown_ += accelerationRotateUpDown_*time; 69 if(abs(speedRotateUpDown_)<accelerationRotateUpDown_*time) 70 speedRotateUpDown_ = 0; 69 71 } 70 72 … … 89 91 if(speedRotateRightLeft_ < 0) 90 92 speedRotateRightLeft_ += accelerationRotateRightLeft_*time; 93 if(abs(speedRotateRightLeft_)<accelerationRotateRightLeft_*time) 94 speedRotateRightLeft_ = 0; 91 95 } 92 96 … … 111 115 if(speedLoopRightLeft_ < 0) 112 116 speedLoopRightLeft_ += accelerationLoopRightLeft_*time; 117 if(abs(speedLoopRightLeft_)<accelerationLoopRightLeft_*time) 118 speedLoopRightLeft_ = 0; 113 119 } 114 120
Note: See TracChangeset
for help on using the changeset viewer.