- Timestamp:
- Nov 30, 2008, 12:36:46 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/physics/src/orxonox/objects/worldentities/ControllableEntity.cc
r2292 r2300 57 57 this->bDestroyWhenPlayerLeft_ = false; 58 58 59 this->velocity_ = Vector3::ZERO;60 59 this->acceleration_ = Vector3::ZERO; 61 60 … … 332 331 if (Core::isMaster()) 333 332 { 334 this->server_position_ = this-> node_->getPosition();333 this->server_position_ = this->getPosition(); 335 334 ++this->server_overwrite_; 336 335 } 337 336 else if (this->bControlled_) 338 337 { 339 this->client_position_ = this-> node_->getPosition();338 this->client_position_ = this->getPosition(); 340 339 } 341 340 } … … 345 344 if (Core::isMaster()) 346 345 { 347 this->server_orientation_ = this-> node_->getOrientation();346 this->server_orientation_ = this->getOrientation(); 348 347 ++this->server_overwrite_; 349 348 } 350 349 else if (this->bControlled_) 351 350 { 352 this->client_orientation_ = this-> node_->getOrientation();351 this->client_orientation_ = this->getOrientation(); 353 352 } 354 353 } … … 358 357 if (Core::isMaster()) 359 358 { 360 this->server_velocity_ = this-> velocity_;359 this->server_velocity_ = this->getVelocity(); 361 360 ++this->server_overwrite_; 362 361 } 363 362 else if (this->bControlled_) 364 363 { 365 this->client_velocity_ = this->velocity_; 366 } 367 } 368 369 void ControllableEntity::setVelocity(const Vector3& velocity) 370 { 371 if (this->bControlled_ || Core::isMaster()) 372 { 373 if (!this->isDynamic()) 374 { 375 // no physics, we do it ourselves 376 internalSetVelocity(velocity); 377 } 378 else 379 { 380 this->physicalBody_->setLinearVelocity(btVector3(velocity.x, velocity.y, velocity.z)); 381 } 382 velocityChanged(); 364 this->client_velocity_ = this->getVelocity(); 383 365 } 384 366 }
Note: See TracChangeset
for help on using the changeset viewer.