Changeset 9052 in orxonox.OLD
- Timestamp:
- Jul 3, 2006, 5:32:34 PM (18 years ago)
- Location:
- branches/single_player_map/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/single_player_map/src/lib/event/event_handler.cc
r9044 r9052 357 357 else 358 358 { 359 //SDL_WM_GrabInput(SDL_GRAB_ON);360 //SDL_ShowCursor(SDL_DISABLE);359 SDL_WM_GrabInput(SDL_GRAB_ON); 360 SDL_ShowCursor(SDL_DISABLE); 361 361 } 362 362 } -
branches/single_player_map/src/world_entities/playable.cc
r9047 r9052 95 95 96 96 LoadParam(root, "abs-dir", this, Playable, setPlayDirection); 97 LoadParam(root, "enter-radius", this, Playable, setEnterRadius) 98 .describe("The Distance one can enter the ship from."); 97 99 } 98 100 -
branches/single_player_map/src/world_entities/space_ships/spacecraft_2d.cc
r9047 r9052 36 36 CREATE_FACTORY(Spacecraft2D, CL_SPACECRAFT_2D); 37 37 38 /**39 * destructs the spacecraft_2d, deletes alocated memory40 */41 Spacecraft2D::~Spacecraft2D ()42 {43 this->setPlayer(NULL);44 }45 38 46 39 /** … … 93 86 94 87 /** 88 * destructs the spacecraft_2d, deletes alocated memory 89 */ 90 Spacecraft2D::~Spacecraft2D () 91 { 92 this->setPlayer(NULL); 93 } 94 95 /** 95 96 * @brief initializes a Spacecraft2D 96 97 */ … … 106 107 mouseSensitivity = 0.005; 107 108 108 this->rotorSpeed = 1000.0f;109 this->rotorCycle = 0.0f;110 109 this->cameraLook = 0.0f; 111 110 this->rotation = 0.0f; 112 111 this->acceleration = 10.0f; 113 this->a irFriction = 2.0f;112 this->altitude = 0.0f; 114 113 115 114 this->setHealthMax(100); … … 118 117 119 118 // camera - issue 120 this-> cameraNode.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE);119 this->travelNode.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE); 121 120 //this->cameraNode.setParentMode(PNODE_ROTATE_MOVEMENT); 122 121 //this->cameraNode.setParent(this); … … 179 178 this->getWeaponManager().setSlotDirection(4, Quaternion(24/180 * M_PI, Vector(1,0,0))); 180 179 181 this-> cameraNode.setRelCoor(1,5,0);182 this->getWeaponManager().getFixedTarget()->setParent(&this->cameraNode);183 this->getWeaponManager().getFixedTarget()->setRelCoor(1000,0,0);180 this->travelNode.setRelCoor(0,0,0); 181 //this->getWeaponManager().getFixedTarget()->setParent(&this->cameraNode); 182 //this->getWeaponManager().getFixedTarget()->setRelCoor(1000,0,0); 184 183 185 184 registerVar( new SynchronizeableBool( &bForward, &bForward, "bForward", PERMISSION_OWNER ) ); … … 206 205 } 207 206 207 void Spacecraft2D::setTravelDirecton(const Quaternion& rot, float speed) 208 { 209 this->setPlayDirection(rot, speed); 210 } 211 212 void Spacecraft2D::setTravelSpeed(float travelSpeed) 213 { 214 this->travelSpeed = travelSpeed; 215 } 216 217 218 208 219 void Spacecraft2D::enter() 209 220 { … … 212 223 if (State::getCameraNode != NULL) 213 224 { 214 State::getCameraNode()->setParentSoft(&this-> cameraNode);215 State::getCameraNode()->setRelCoorSoft(-10, 0,0);216 State::getCameraTargetNode()->setParentSoft(&this-> cameraNode);225 State::getCameraNode()->setParentSoft(&this->travelNode); 226 State::getCameraNode()->setRelCoorSoft(-10, 50,0); 227 State::getCameraTargetNode()->setParentSoft(&this->travelNode); 217 228 } 218 229 } … … 264 275 // spaceship controlled movement 265 276 this->movement(dt); 266 this->rotorCycle += this->rotorSpeed * dt;267 277 268 278 // TRYING TO FIX PNode. 269 this->cameraNode.setAbsCoorSoft(this->getAbsCoor() + Vector(0.0f, 5.0f, 0.0f), 30.0f);270 this->cameraNode.setRelDirSoft(this->getAbsDir(), 30.0f);279 //this->travelNode.setAbsCoorSoft(this->getAbsCoor() + Vector(0.0f, 5.0f, 0.0f), 30.0f); 280 //this->travelNode.setRelDirSoft(this->getAbsDir(), 30.0f); 271 281 } 272 282 … … 297 307 accel += Vector(0, 0, this->acceleration); 298 308 } 309 299 310 300 311 switch(this->getPlaymode()) … … 305 316 306 317 // this is the air friction (necessary for a smooth control) 307 Vector damping = (this->velocity * this->airFriction); 308 309 310 this->velocity += (accelerationDir - damping)* dt; 318 319 this->velocity += (accelerationDir)* dt; 311 320 this->shiftCoor (this->velocity * dt); 312 321 … … 334 343 335 344 // this is the air friction (necessary for a smooth control) 336 Vector damping = (this->velocity * this->airFriction); 337 338 339 this->velocity += (accelerationDir - damping)* dt; 345 346 347 this->velocity += (accelerationDir )* dt; 340 348 this->shiftCoor (this->velocity * dt); 341 349 … … 344 352 { 345 353 float maxRot = 10.0 * dt; 346 if (unlikely(this->rotation > maxRot)) this->rotation = maxRot; 347 if (unlikely(this->rotation < -maxRot)) this->rotation = -maxRot; 354 if (unlikely(this->rotation > 0.01 || this->rotation < 0.01)) this->rotation /=1.5; 348 355 this->direction *= Quaternion(-M_PI/4.0*this->rotation, Vector(0,1,0)); 349 356 … … 355 362 break; 356 363 357 case Playable::Vertical:358 {359 accel.z = 0;360 Vector accelerationDir = this->getAbsDir().apply(accel * this->acceleration);361 accelerationDir.z=0;362 363 // this is the air friction (necessary for a smooth control)364 Vector damping = (this->velocity * this->airFriction);365 366 this->velocity += (accelerationDir - damping)* dt;367 this->shiftCoor (this->velocity * dt);368 369 this->setRelDirSoft(this->direction * Quaternion(-cameraLook, Vector(0,0,1)), 5);370 }371 break;372 364 default: 373 365 PRINTF(2)("Playmode %s Not Implemented\n", Playable::playmodeToString(this->getPlaymode()).c_str()); … … 403 395 404 396 // rotate the Player around the y-axis 405 this->rotation += xMouse; 397 if (this->getPlaymode() == Playable::Full3D) 398 this->rotation += xMouse; 406 399 407 400 this->cameraLook += yMouse; -
branches/single_player_map/src/world_entities/space_ships/spacecraft_2d.h
r9046 r9052 23 23 virtual void loadParams(const TiXmlElement* root); 24 24 virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f); 25 void setTravelDirecton(const Quaternion& rot, float speed = 0.0); 26 void setTravelSpeed(float travelSpeed); 27 25 28 virtual void enter(); 26 29 virtual void leave(); 30 31 27 32 28 33 virtual void postSpawn(); … … 48 53 float mouseSensitivity; //!< the mouse sensitivity 49 54 50 PNode cameraNode; 55 56 57 PNode travelNode; 58 float travelSpeed; 59 51 60 float cameraLook; 52 61 float rotation; … … 54 63 // Vector velocity; //!< the velocity of the Spacecraft2D. 55 64 Quaternion direction; //!< the direction of the Spacecraft2D. 56 float travelSpeed; //!< the current speed of the Hove (to make soft movement)57 65 float acceleration; //!< the acceleration of the Spacecraft2D. 58 float airFriction; //!< AirFriction.66 float maxSpeed; //!< The Maximal speed of the Spacecraft2D. 59 67 60 float rotorSpeed; //!< the speed of the rotor. 61 float rotorCycle; //!< The Cycle the rotor is in. 62 63 float airViscosity; 68 float altitude; //!< The height in the Entity. 64 69 65 70 ParticleEmitter* burstEmitter;
Note: See TracChangeset
for help on using the changeset viewer.