- Timestamp:
- Dec 14, 2008, 10:53:44 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/physics_merge/src/orxonox/objects/worldentities/WorldEntity.cc
r2446 r2452 605 605 void WorldEntity::recalculateMassProps() 606 606 { 607 // Store local inertia for faster access. Evaluates to (0,0,0) if there is no collision shape. 608 float totalMass = this->mass_ + this->childrenMass_; 609 this->collisionShape_->calculateLocalInertia(totalMass, this->localInertia_); 607 610 if (this->hasPhysics()) 608 611 { … … 616 619 // Use default values to avoid very large or very small values 617 620 CCOUT(4) << "Warning: Setting the internal physical mass to 1.0 because mass_ is 0.0." << std::endl; 618 this->physicalBody_->setMassProps(1.0f, this->collisionShape_->getLocalInertia(1.0f)); 621 btVector3 inertia(0, 0, 0); 622 this->collisionShape_->calculateLocalInertia(1.0f, inertia); 623 this->physicalBody_->setMassProps(1.0f, inertia); 619 624 } 620 625 else 621 626 { 622 float mass = this->mass_ + this->childrenMass_; 623 this->physicalBody_->setMassProps(mass, this->collisionShape_->getLocalInertia(mass)); 627 this->physicalBody_->setMassProps(totalMass, this->localInertia_); 624 628 } 625 629 }
Note: See TracChangeset
for help on using the changeset viewer.