- Timestamp:
- Dec 11, 2008, 1:54:35 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/physics/src/orxonox/objects/worldentities/ControllableEntity.cc
r2374 r2407 23 23 * Fabian 'x3n' Landau 24 24 * Co-authors: 25 * ...25 * Reto Grieder 26 26 * 27 27 */ … … 256 256 { 257 257 if (!this->bControlled_) 258 {259 //COUT(0) << "override with server position: " << this << std::endl;260 258 this->setPosition(this->server_position_); 261 }262 259 } 263 260 … … 282 279 void ControllableEntity::processOverwrite() 283 280 { 284 //if (this->bControlled_)285 //{286 // COUT(0) << "complete override: " << this << std::endl;287 // this->setPosition(this->server_position_);288 // this->setVelocity(this->server_velocity_);289 // this->setOrientation(this->server_orientation_);290 291 //this->client_overwrite_ = this->server_overwrite_;292 //}281 if (this->bControlled_) 282 { 283 this->setPosition(this->server_position_); 284 this->setOrientation(this->server_orientation_); 285 this->setVelocity(this->server_linear_velocity_); 286 this->setAngularVelocity(this->server_angular_velocity_); 287 288 this->client_overwrite_ = this->server_overwrite_; 289 } 293 290 } 294 291 295 292 void ControllableEntity::processClientPosition() 296 293 { 297 //if (this->server_overwrite_ == this->client_overwrite_) 298 if (!this->bControlled_) 299 { 300 //COUT(0) << "override with client position: " << this << std::endl; 301 // COUT(2) << "callback: setting client position" << endl; 294 if (this->server_overwrite_ == this->client_overwrite_) 295 { 302 296 this->setPosition(this->client_position_); 303 //this->server_position_ = this->client_position_; 304 } 305 //else 306 // COUT(2) << "callback: not setting client position" << endl; 297 // The call above increments the overwrite. This is not desired to reduce traffic 298 --this->server_overwrite_; 299 } 307 300 } 308 301 309 302 void ControllableEntity::processClientLinearVelocity() 310 303 { 311 if (!this->bControlled_) 312 //if (this->server_overwrite_ == this->client_overwrite_) 304 if (this->server_overwrite_ == this->client_overwrite_) 313 305 { 314 306 this->setVelocity(this->client_linear_velocity_); 315 //this->server_velocity_ = this->client_velocity_; 307 // The call above increments the overwrite. This is not desired to reduce traffic 308 --this->server_overwrite_; 316 309 } 317 310 } … … 319 312 void ControllableEntity::processClientOrientation() 320 313 { 321 if (!this->bControlled_) 322 //if (this->server_overwrite_ == this->client_overwrite_) 314 if (this->server_overwrite_ == this->client_overwrite_) 323 315 { 324 316 this->setOrientation(this->client_orientation_); 325 //this->server_orientation_ = this->client_orientation_; 317 // The call above increments the overwrite. This is not desired to reduce traffic 318 --this->server_overwrite_; 326 319 } 327 320 } … … 329 322 void ControllableEntity::processClientAngularVelocity() 330 323 { 331 if (!this->bControlled_) 332 //if (this->server_overwrite_ == this->client_overwrite_) 324 if (this->server_overwrite_ == this->client_overwrite_) 333 325 { 334 326 this->setAngularVelocity(this->client_angular_velocity_); 335 //this->server_velocity_ = this->client_velocity_; 327 // The call above increments the overwrite. This is not desired to reduce traffic 328 --this->server_overwrite_; 336 329 } 337 330 } … … 342 335 { 343 336 this->server_position_ = this->getPosition(); 344 ++this->server_overwrite_; 337 if (!bContinuous) 338 ++this->server_overwrite_; 345 339 } 346 340 else if (this->bControlled_) … … 355 349 { 356 350 this->server_orientation_ = this->getOrientation(); 357 ++this->server_overwrite_; 351 if (!bContinuous) 352 ++this->server_overwrite_; 358 353 } 359 354 else if (this->bControlled_) … … 368 363 { 369 364 this->server_linear_velocity_ = this->getVelocity(); 370 ++this->server_overwrite_; 365 if (!bContinuous) 366 ++this->server_overwrite_; 371 367 } 372 368 else if (this->bControlled_) … … 381 377 { 382 378 this->server_angular_velocity_ = this->getAngularVelocity(); 383 ++this->server_overwrite_; 379 if (!bContinuous) 380 ++this->server_overwrite_; 384 381 } 385 382 else if (this->bControlled_)
Note: See TracChangeset
for help on using the changeset viewer.