Changeset 6234 in orxonox.OLD for branches/spaceshipcontrol
- Timestamp:
- Dec 21, 2005, 3:14:00 PM (19 years ago)
- Location:
- branches/spaceshipcontrol/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/spaceshipcontrol/src/story_entities/world.cc
r6222 r6234 341 341 } 342 342 343 // bind camera344 playable->addChild (this->localCamera);345 343 346 344 // //localCamera->setParent(TrackNode::getInstance()); -
branches/spaceshipcontrol/src/world_entities/playable.cc
r6142 r6234 20 20 #include "event_handler.h" 21 21 #include "player.h" 22 #include "state.h" 22 23 23 24 … … 72 73 for (ev = this->events.begin(); ev != events.end(); ev++) 73 74 evh->subscribe(player, ES_GAME, (*ev)); 74 75 this->enter(); 75 76 return true; 76 77 } … … 97 98 evh->unsubscribe( ES_GAME, (*ev)); 98 99 100 this->leave(); 99 101 this->currentPlayer = NULL; 100 102 return true; … … 127 129 128 130 131 void Playable::attachCamera() 132 { 133 State::getCamera()->setParentSoft(this); 134 State::getCameraTarget()->setParentSoft(this); 135 136 } 137 138 139 void Playable::detachCamera() 140 { 141 142 143 } -
branches/spaceshipcontrol/src/world_entities/playable.h
r6222 r6234 25 25 virtual ~Playable(); 26 26 27 virtual void enter() {};28 virtual void leave() {};27 virtual void enter()=0; 28 virtual void leave()=0; 29 29 30 30 virtual void addWeapon(Weapon* weapon ) {}//= 0; … … 34 34 bool subscribePlayer(Player* player); 35 35 bool unsubscribePlayer(Player* player); 36 37 void attachCamera(); 38 void detachCamera(); 36 39 37 40 virtual void process(const Event &event) = 0; -
branches/spaceshipcontrol/src/world_entities/player.cc
r6222 r6234 95 95 if (this->controllable != (*node) && (dynamic_cast<PNode*>(*node)->getAbsCoor() - this->controllable->getAbsCoor()).len() < 10.0) 96 96 { 97 this->controllable->leave();97 98 98 this->disconnectControllable(); 99 99 this->setControllable(dynamic_cast<Playable*>(*node)); 100 this->controllable->enter();101 State::getCamera()->setParentSoft(this->controllable);102 State::getCameraTarget()->setParentSoft(this->controllable);103 100 104 101 break; -
branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.cc
r6222 r6234 112 112 PRINTF(4)("SPACESHIP INIT\n"); 113 113 114 //EventHandler::getInstance()->grabEvents(true);114 EventHandler::getInstance()->grabEvents(true); 115 115 116 116 bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false; … … 193 193 { 194 194 dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( true); 195 this->attachCamera(); 195 196 196 197 … … 200 201 { 201 202 dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false); 203 this->detachCamera(); 202 204 203 205 … … 284 286 285 287 //orient the spaceship in direction of the mouse 286 rotQuat = Quaternion::quatSlerp( this->getAbsDir(), mouseDir,fabsf(time)*3);287 if (this->getAbsDir().distance(rotQuat) > 0.00 1)288 rotQuat = Quaternion::quatSlerp( this->getAbsDir(), mouseDir, fabsf(time)*3.0); 289 if (this->getAbsDir().distance(rotQuat) > 0.00000000000001) 288 290 this->setAbsDir( rotQuat); 289 291 //this->setAbsDirSoft(mouseDir,5); … … 440 442 this->yMouse = event.yRel; 441 443 mouseDir *= (Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1))); 442 if( xMouse*xMouse + yMouse*yMouse < 0.9)443 this->setAbsDir(mouseDir);444 // if( xMouse*xMouse + yMouse*yMouse < 0.9) 445 //this->setAbsDir(mouseDir); 444 446 } 445 447 } -
branches/spaceshipcontrol/src/world_entities/weapons/guided_missile.cc
r6222 r6234 146 146 { 147 147 148 if (this->target != NULL && this->target->getParent() != PNode::getNullParent()) 148 149 if (this->target != NULL && this->target->getParent() != PNode::getNullParent()) 149 150 { 150 151 speed = velocity.len(); … … 152 153 153 154 if(velocity.dot(diffVector) != 0) 154 {155 { 155 156 correctionVector = (( ( diffVector * (speed * speed/( velocity.dot(diffVector ) ) )) - velocity).getNormalized()) * agility; 156 157 … … 159 160 else if (velocity.dot(diffVector) < 0) 160 161 velocity -= correctionVector; 161 }162 } 162 163 else 163 164 velocity += diffVector * agility;
Note: See TracChangeset
for help on using the changeset viewer.