- Timestamp:
- Nov 30, 2008, 12:36:46 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/physics/src/orxonox/objects/worldentities/WorldEntity.cc
r2298 r2300 192 192 } 193 193 194 float WorldEntity::getMass() 194 float WorldEntity::getMass() const 195 195 { 196 196 if (!checkPhysics()) 197 197 return 0.0f; 198 198 199 return 1.0f/this->physicalBody_->getInvMass(); 199 if (this->physicalBody_->getInvMass() == 0.0f) 200 return 0.0f; 201 else 202 return 1.0f/this->physicalBody_->getInvMass(); 200 203 } 201 204 … … 221 224 if (type != None && this->collisionType_ == None) 222 225 { 226 // First, check whether our SceneNode is relative to the root space of the scene. 227 // TODO: Static and Kinematic objects don't always have to obey this rule. 228 if (this->node_->getParent() != this->getScene()->getRootSceneNode()) 229 ThrowException(PhysicsViolation, "Cannot make WorldEntity physical that is not in the root space of the Scene."); 230 223 231 // Create new rigid body 224 232 btRigidBody::btRigidBodyConstructionInfo bodyConstructionInfo(0, this, 0, btVector3(0,0,0)); … … 227 235 228 236 // Adjust parameters according to the node 229 btTransform nodeTransform;237 //btTransform nodeTransform; 230 238 //this-> 231 239 } … … 303 311 } 304 312 305 std::string WorldEntity::getCollisionTypeStr() 313 std::string WorldEntity::getCollisionTypeStr() const 306 314 { 307 315 switch (this->getCollisionType()) … … 334 342 } 335 343 336 float WorldEntity::getCollisionRadius() 344 float WorldEntity::getCollisionRadius() const 337 345 { 338 346 if (checkPhysics()) … … 345 353 } 346 354 347 bool WorldEntity::checkPhysics() 355 bool WorldEntity::checkPhysics() const 348 356 { 349 357 if (!this->physicalBody_)
Note: See TracChangeset
for help on using the changeset viewer.