Changeset 1245 for code/branches/network3/src/orxonox
- Timestamp:
- May 7, 2008, 4:39:42 PM (17 years ago)
- Location:
- code/branches/network3/src/orxonox/objects
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network3/src/orxonox/objects/SpaceShip.cc
r1234 r1245 104 104 this->setRotationAxis(1, 0, 0); 105 105 this->setStatic(false); 106 /*107 this->moveForward_ = 0;108 this->rotateUp_ = 0;109 this->rotateDown_ = 0;110 this->rotateRight_ = 0;111 this->rotateLeft_ = 0;112 this->loopRight_ = 0;113 this->loopLeft_ = 0;114 this->brakeForward_ = 0;115 this->brakeRotate_ = 0;116 this->brakeLoop_ = 0;117 this->speedForward_ = 0;118 this->speedRotateUpDown_ = 0;119 this->speedRotateRightLeft_ = 0;120 this->speedLoopRightLeft_ = 0;121 this->maxSpeedForward_ = 0;122 this->maxSpeedRotateUpDown_ = 0;123 this->maxSpeedRotateRightLeft_ = 0;124 this->maxSpeedLoopRightLeft_ = 0;125 this->accelerationForward_ = 0;126 this->accelerationRotateUpDown_ = 0;127 this->accelerationRotateRightLeft_ = 0;128 this->accelerationLoopRightLeft_ = 0;129 130 this->speed = 250;131 this->loop = 100;132 this->rotate = 10;133 this->mouseX = 0;134 this->mouseY = 0;135 this->maxMouseX = 0;136 this->minMouseX = 0;137 this->moved = false;138 139 this->brakeRotate(rotate*10);140 this->brakeLoop(loop);141 */142 // this->create();143 106 144 107 … … 161 124 162 125 void SpaceShip::registerAllVariables(){ 163 registerVar( &camName_, camName_.length()+1, network::STRING); 126 registerVar( &camName_, camName_.length()+1, network::STRING, 0x1); 127 registerVar( &maxSpeed_, sizeof(maxSpeed_), network::DATA, 0x1); 128 registerVar( &maxSideAndBackSpeed_, sizeof(maxSideAndBackSpeed_), network::DATA, 0x1); 129 registerVar( &maxRotation_, sizeof(maxRotation_), network::DATA, 0x1); 130 registerVar( &translationAcceleration_, sizeof(translationAcceleration_), network::DATA, 0x1); 131 registerVar( &rotationAcceleration_, sizeof(rotationAcceleration_), network::DATA, 0x1); 132 registerVar( &rotationAccelerationRadian_, sizeof(rotationAccelerationRadian_), network::DATA, 0x1); 133 registerVar( &translationDamping_, sizeof(translationDamping_), network::DATA, 0x1); 134 registerVar( &rotationDamping_, sizeof(rotationDamping_), network::DATA, 0x1); 135 registerVar( &rotationDampingRadian_, sizeof(rotationDampingRadian_), network::DATA, 0x1); 136 164 137 } 165 138 166 139 void SpaceShip::init() 167 140 { 168 COUT(4) << "================ \t\t\t\tspaceship::init" << std::endl;141 // COUT(4) << "================ \t\t\t\tspaceship::init" << std::endl; 169 142 // START CREATING THRUSTER 170 143 this->tt_ = new ParticleInterface(GraphicsEngine::getSingleton().getSceneManager(),"twinthruster" + this->getName(),"Orxonox/engineglow"); … … 197 170 this->greenNode_->setInheritScale(false); 198 171 199 COUT(4) << "attaching red billboard" << std::endl;172 // COUT(4) << "attaching red billboard" << std::endl; 200 173 this->redNode_->attachObject(this->redBillboard_.getBillboardSet()); 201 174 this->redNode_->setScale(0.3, 0.3, 0.3); 202 175 203 COUT(4) << "attaching green billboard" << std::endl;176 // COUT(4) << "attaching green billboard" << std::endl; 204 177 this->greenNode_->attachObject(this->greenBillboard_.getBillboardSet()); 205 178 this->greenNode_->setScale(0.3, 0.3, 0.3); … … 215 188 this->chFarNode_->setInheritScale(false); 216 189 217 COUT(4) << "attaching crosshair near billboard" << std::endl;190 // COUT(4) << "attaching crosshair near billboard" << std::endl; 218 191 this->chNearNode_->attachObject(this->crosshairNear_.getBillboardSet()); 219 192 this->chNearNode_->setScale(0.2, 0.2, 0.2); 220 193 221 COUT(4) << "attaching crosshair far billboard" << std::endl;194 // COUT(4) << "attaching crosshair far billboard" << std::endl; 222 195 this->chFarNode_->attachObject(this->crosshairFar_.getBillboardSet()); 223 196 this->chFarNode_->setScale(0.4, 0.4, 0.4); 224 COUT(4) << "attaching camera" << std::endl;197 // COUT(4) << "attaching camera" << std::endl; 225 198 226 199 createCamera(); … … 237 210 void SpaceShip::loadParams(TiXmlElement* xmlElem) 238 211 { 239 COUT(4) << "using loadparams" << std::endl;212 // COUT(4) << "using loadparams" << std::endl; 240 213 Model::loadParams(xmlElem); 241 214 this->create(); … … 303 276 304 277 void SpaceShip::createCamera(){ 305 COUT(4) << "begin camera creation" << std::endl;278 // COUT(4) << "begin camera creation" << std::endl; 306 279 this->camNode_ = this->getNode()->createChildSceneNode(camName_); 307 280 COUT(4) << "position: (this)" << this->getNode()->getPosition() << std::endl; … … 313 286 cam->lookAt(Vector3(0,20,0)); 314 287 cam->roll(Degree(0)); 315 */ COUT(4) << "creating new camera" << std::endl;288 *//*COUT(4) << "creating new camera" << std::endl;*/ 316 289 cam_ = new Camera(this->camNode_); 317 COUT(4) << "setting target node" << std::endl;290 // COUT(4) << "setting target node" << std::endl; 318 291 cam_->setTargetNode(this->getNode()); 319 292 // this only applies to clients 320 if(network::Client::getSingleton()!=0 && network::Client::getSingleton()->getShipID()==objectID) 293 if(network::Client::getSingleton()!=0 && network::Client::getSingleton()->getShipID()==objectID){ 294 this->setBacksync(true); 321 295 CameraHandler::getInstance()->requestFocus(cam_); 296 } 322 297 // cam->setPosition(Vector3(0,-350,0)); 323 298 //cam->roll(Degree(-90)); 324 299 325 300 //this->camNode_->attachObject(cam); 326 COUT(4) << "created camera" << std::endl;301 // COUT(4) << "created camera" << std::endl; 327 302 } 328 303 … … 460 435 { 461 436 // only do this if not client TODO: remove this hack 462 if ( !network::Client::getSingleton() && InputManager::getSingleton().getMouse()->getEventCallback() != this)437 if ((!network::Client::getSingleton() || network::Client::getSingleton()->getShipID()==objectID ) && InputManager::getSingleton().getMouse()->getEventCallback() != this) 463 438 { 464 439 if (InputManager::getSingleton().getMouse()) … … 485 460 if (this->bLMousePressed_ && this->timeToReload_ <= 0) 486 461 { 487 new Projectile(this); 462 Projectile *p = new Projectile(this); 463 p->setBacksync(true); 488 464 this->timeToReload_ = this->reloadTime_; 489 465 } … … 560 536 561 537 if(!network::Client::getSingleton() || network::Client::getSingleton()->getShipID() == objectID){ 538 COUT(4) << "steering our ship: " << objectID << " mkeyboard: " << mKeyboard << std::endl; 562 539 if (mKeyboard->isKeyDown(OIS::KC_UP) || mKeyboard->isKeyDown(OIS::KC_W)) 563 540 this->acceleration_.x = this->translationAcceleration_; … … 580 557 else 581 558 this->momentum_ = 0; 582 } 559 }/*else 560 COUT(4) << "not steering ship: " << objectID << " our ship: " << network::Client::getSingleton()->getShipID() << std::endl;*/ 583 561 584 562 WorldEntity::tick(dt); -
code/branches/network3/src/orxonox/objects/WorldEntity.cc
r1232 r1245 81 81 if (!this->bStatic_) 82 82 { 83 // COUT(4) << "acceleration: " << this->acceleration_ << " velocity: " << this->velocity_ << std::endl; 83 84 this->velocity_ += (dt * this->acceleration_); 84 85 this->translate(dt * this->velocity_, Ogre::Node::TS_LOCAL); … … 222 223 //register acceleration 223 224 // register velocity_ 224 registerVar( (void*) &(this->getAcceleration().x), sizeof(this->getAcceleration().x), network::DATA, 0x3);225 registerVar( (void*) &(this->getAcceleration().y), sizeof(this->getAcceleration().y), network::DATA, 0x3);226 registerVar( (void*) &(this->getAcceleration().z), sizeof(this->getAcceleration().z), network::DATA, 0x3);225 // registerVar( (void*) &(this->getAcceleration().x), sizeof(this->getAcceleration().x), network::DATA, 0x3); 226 // registerVar( (void*) &(this->getAcceleration().y), sizeof(this->getAcceleration().y), network::DATA, 0x3); 227 // registerVar( (void*) &(this->getAcceleration().z), sizeof(this->getAcceleration().z), network::DATA, 0x3); 227 228 } 228 229
Note: See TracChangeset
for help on using the changeset viewer.