- Timestamp:
- Jan 28, 2006, 2:57:27 PM (19 years ago)
- Location:
- trunk/src/world_entities
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/camera.cc
r6780 r6807 111 111 case VIEW_NORMAL: 112 112 this->toFovy = 60.0; 113 /* this->setParentSoft("TrackNode");114 this->target->setParentSoft("TrackNode"); */115 113 this->setRelCoorSoft(-10, 5, 0); 116 114 this->target->setRelCoorSoft(0,0,0); 117 115 break; 118 116 case VIEW_BEHIND: 119 // this->toFovy = 120.0;120 // this->setRelCoorSoft(Vector(3.5, 0, 0));121 // this->target->setRelCoorSoft(Vector(10,0,0));122 123 // if (!strcmp(this->target->getParent()->getName(), "Player"))124 // this->target->setParentSoft("TrackNode");125 // else126 // this->target->setParentSoft("Player");127 // this->getParent()->debugNode(0);128 129 // this->setParent("main-Turret");130 // this->setParentMode(PNODE_ALL);131 // this->target->setParentSoft("Player");132 133 117 break; 134 118 case VIEW_FRONT: 135 119 this->toFovy = 120.0; 136 /* this->setParentSoft("Player");137 this->target->setParentSoft("Player");*/138 120 this->setRelCoorSoft(4, 0, 0, 5); 139 121 this->target->setRelCoorSoft(Vector(10,0,0), 5); 140 // this->target->setRelDirSoft(Quaternion(M_PI/4.0, Vector(0,1,0)));141 122 break; 142 123 case VIEW_LEFT: 143 124 this->toFovy = 90; 144 /* this->setParentSoft("TrackNode");145 this->target->setParentSoft("TrackNode");*/146 125 this->setRelCoorSoft(0, 1, -10, .5); 147 126 this->target->setRelCoorSoft(0,0,0); … … 149 128 case VIEW_RIGHT: 150 129 this->toFovy = 90; 151 /* this->setParentSoft("TrackNode");152 this->target->setParentSoft("TrackNode");*/153 130 this->setRelCoorSoft(Vector(0, 1, 10)); 154 131 this->target->setRelCoorSoft(0,0,0); … … 156 133 case VIEW_TOP: 157 134 this->toFovy= 120; 158 /* this->setParentSoft("TrackNode");159 this->target->setParentSoft("TrackNode");*/160 135 this->setRelCoorSoft(Vector(30, 50, 0)); 161 136 this->target->setRelCoorSoft(35,0,0); -
trunk/src/world_entities/space_ships/hover.cc
r6806 r6807 99 99 this->setClassID(CL_HOVER, "Hover"); 100 100 101 PRINTF(4)("HOVER INIT\n"); 102 103 this->loadModel("models/ships/hover_#.obj", 1.0); 104 105 EventHandler::getInstance()->grabEvents(true); 101 this->loadModel("models/ships/hoverglider_wing.obj", 1.0f, 3); 102 this->loadModel("models/ships/hoverglider_rotor.obj", 1.0f, 4); 103 this->loadModel("models/ships/rotor.obj", .45f, 5); 106 104 107 105 bForward = bBackward = bLeft = bRight = bAscend = bDescend = false; 108 xMouse = yMouse = 0; 109 mouseSensitivity = 0.05; 110 controlVelocityX = 100; 111 controlVelocityY = 100; 106 mouseSensitivity = 0.005; 112 107 113 108 this->rotorSpeed = 1000.0f; 114 109 this->rotorCycle = 0.0f; 110 this->cameraLook = 0.0f; 111 this->rotation = 0.0f; 115 112 116 113 // camera - issue … … 138 135 dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false); 139 136 140 this->loadModel("models/ships/hoverglider_wing.obj", 1.0f, 3);141 this->loadModel("models/ships/hoverglider_rotor.obj", 1.0f, 4);142 this->loadModel("models/ships/rotor.obj", .45f, 5);143 137 144 138 //add events to the eventlist … … 177 171 this->getWeaponManager()->setSlotDirection(4, Quaternion(24/180 * M_PI, Vector(1,0,0))); 178 172 179 this->getWeaponManager()->getFixedTarget()->setParent(&(this->cameraNode)); 173 this->cameraNode.setRelCoor(1,5,0); 174 this->getWeaponManager()->getFixedTarget()->setParent(&this->cameraNode); 175 this->getWeaponManager()->getFixedTarget()->setRelCoor(1000,0,0); 180 176 } 181 177 … … 192 188 { 193 189 State::getCamera()->setParentSoft(&this->cameraNode); 194 State::getCamera Target()->setParentSoft(this->getWeaponManager()->getFixedTarget());195 190 State::getCamera()->setRelCoorSoft(-10, 0,0); 191 State::getCameraTarget()->setParentSoft(&this->cameraNode); 196 192 } 197 193 … … 234 230 */ 235 231 void Hover::collidesWith(WorldEntity* entity, const Vector& location) 236 { 237 } 232 {} 238 233 239 234 … … 246 241 { 247 242 Playable::tick(dt); 248 249 if( xMouse != 0 || yMouse != 0)250 {251 if (xMouse > controlVelocityX) xMouse = controlVelocityX;252 else if (xMouse < -controlVelocityX) xMouse = -controlVelocityX;253 if (yMouse > controlVelocityY) yMouse = controlVelocityY;254 else if (yMouse < -controlVelocityY) yMouse = -controlVelocityY;255 }256 243 257 244 // spaceship controlled movement … … 262 249 263 250 // this is the air friction (necessary for a smooth control) 264 if(velocity.len() != 0) velocity -= velocity*0.1; 265 this->shiftCoor (move); 266 251 if(velocity.len() != 0) 252 velocity -= velocity*0.1; 253 this->shiftCoor (move); 254 255 this->rotation = 0.0f; 267 256 } 268 257 … … 276 265 float rotVal = .3; 277 266 278 if( this->bForward ) 267 if( this->bForward ) { 279 268 accel += Vector(rotVal, 0, 0); 280 269 } 281 270 282 271 if( this->bBackward ) { 283 272 accel -= Vector(rotVal,0,0); 284 273 } 285 274 if( this->bLeft) { 286 275 accel -= Vector(0,0,rotVal); 287 276 } 277 288 278 if( this->bRight) { 289 279 accel += Vector(0,0,rotVal); … … 293 283 accel += Vector(0,rotVal,0); 294 284 } 295 if (this->bDescend ) 296 accel -= Vector(0,rotVal,0); 285 if (this->bDescend ) { 286 accel -= Vector(0,rotVal,0); 287 } 297 288 298 289 velocity += accel * 3.0; … … 300 291 this->setRelDirSoft(this->direction * Quaternion(-accel.x, Vector(0,0,1)) * Quaternion(accel.z, Vector(1,0,0)), 5); 301 292 302 this->wingNodeLeft.setRelDirSoft(Quaternion(accel.z , Vector(1,0,0)), 10);303 this->rotorNodeLeft.setRelDirSoft(Quaternion(-2.0*accel.x , Vector(0,0,1)), 10);304 305 this->wingNodeRight.setRelDirSoft(Quaternion(accel.z , Vector(1,0,0)), 10);306 this->rotorNodeRight.setRelDirSoft(Quaternion(-2.0*accel.x , Vector(0,0,1)), 10);293 this->wingNodeLeft.setRelDirSoft(Quaternion(accel.z+this->rotation, Vector(1,0,0)), 10); 294 this->rotorNodeLeft.setRelDirSoft(Quaternion(-2.0*accel.x+this->rotation, Vector(0,0,1)), 10); 295 296 this->wingNodeRight.setRelDirSoft(Quaternion(accel.z+this->rotation, Vector(1,0,0)), 10); 297 this->rotorNodeRight.setRelDirSoft(Quaternion(-2.0*accel.x-this->rotation, Vector(0,0,1)), 10); 307 298 } 308 299 … … 381 372 else if( event.type == EV_MOUSE_MOTION) 382 373 { 383 this->xMouse = event.xRel*mouseSensitivity; 384 this->yMouse = event.yRel*mouseSensitivity; 374 float xMouse, yMouse; 375 xMouse = event.xRel*mouseSensitivity; 376 yMouse = event.yRel*mouseSensitivity; 385 377 386 378 // rotate the Player around the y-axis 387 this->direction *= Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0)); 388 379 this->direction *= Quaternion(-M_PI/4.0*xMouse, Vector(0,1,0)); 380 this->rotation += xMouse; 381 382 this->cameraLook += yMouse; 389 383 // rotate the Camera around the z-axis 390 Quaternion yDir = Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1)); 391 if ((this->cameraNode.getAbsDirY()).y < 0.5) 392 { 393 if((this->cameraNode.getAbsDirX()).y > 0) 394 { 395 if(yMouse > 0) this->cameraNode.shiftDir(yDir); 396 } 397 else 398 { 399 if(yMouse < 0) this->cameraNode.shiftDir(yDir); 400 } 401 } 402 else this->cameraNode.shiftDir(yDir); 403 } 404 } 384 if (cameraLook > M_PI_4) 385 cameraLook = M_PI_4; 386 else if (cameraLook < -M_PI_2) 387 cameraLook = -M_PI_2; 388 this->cameraNode.setRelDirSoft(Quaternion(-cameraLook, Vector(0,0,1)),5); 389 } 390 } -
trunk/src/world_entities/space_ships/hover.h
r6806 r6807 45 45 bool bDescend; //!< descend button presses. 46 46 47 float xMouse; //!< mouse moved in x-Direction48 float yMouse; //!< mouse moved in y-Direction49 47 int yInvert; 50 48 float mouseSensitivity; //!< the mouse sensitivity 51 int controlVelocityX;52 int controlVelocityY;53 //float cycle; //!< hovercycle54 49 55 50 PNode wingNodeLeft; … … 59 54 60 55 PNode cameraNode; 56 float cameraLook; 57 float rotation; 61 58 62 59 Vector velocity; //!< the velocity of the Hover. -
trunk/src/world_entities/space_ships/space_ship.cc
r6804 r6807 56 56 CREATE_FACTORY(SpaceShip, CL_SPACE_SHIP); 57 57 58 /**59 * creates the controlable Spaceship60 */61 SpaceShip::SpaceShip()62 {63 this->init();64 }65 58 66 59 /** -
trunk/src/world_entities/space_ships/space_ship.h
r6804 r6807 21 21 22 22 public: 23 24 SpaceShip();25 23 SpaceShip(const char* fileName); 26 SpaceShip(const TiXmlElement* root );24 SpaceShip(const TiXmlElement* root = NULL); 27 25 virtual ~SpaceShip(); 28 26 -
trunk/src/world_entities/weapons/crosshair.cc
r6512 r6807 135 135 this->shiftDir2D(dt * rotationSpeed); 136 136 137 137 /* 138 138 float z = 0.0f; 139 139 glReadPixels ((int)this->getAbsCoor2D().x, … … 155 155 &objX, 156 156 &objY, 157 &objZ ); 157 &objZ );*/ 158 158 159 159 //this->setAbsCoor(objX, objY, objZ); … … 181 181 glEnd(); 182 182 glPopMatrix(); 183 184 183 } -
trunk/src/world_entities/weapons/weapon_manager.cc
r6803 r6807 104 104 // CROSSHAIR INITIALISATION 105 105 this->crosshair = new Crosshair(); 106 106 //this->crosshair->setRelCoor(1000,0,0); 107 107 this->crossHairSizeAnim = new tAnimation<Crosshair>(this->crosshair, &Crosshair::setSize); 108 108 this->crossHairSizeAnim->setInfinity(ANIM_INF_REWIND);
Note: See TracChangeset
for help on using the changeset viewer.