Changeset 4375 in orxonox.OLD for orxonox/trunk/src/lib/physics/physics_interface.cc
- Timestamp:
- May 29, 2005, 11:55:57 AM (19 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/physics/physics_interface.cc
r4371 r4375 13 13 ### File Specific: 14 14 main-programmer: Patrick Boenzli 15 co-programmer: ... 15 co-programmer: Benjamin Grauer 16 17 bensch: renamed the file 16 18 */ 17 19 18 20 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_PHYSICS 19 21 20 #include " i_physics.h"22 #include "physics_interface.h" 21 23 #include "list.h" 22 24 #include "string.h" … … 29 31 \brief standard constructor 30 32 */ 31 IPhysics::IPhysics()33 PhysicsInterface::PhysicsInterface () 32 34 { 33 this->setClassName (" IPhysics");35 this->setClassName ("PhysicsInterface"); 34 36 this->mass = 0; 35 37 this->massChildren = 0; … … 42 44 43 45 */ 44 IPhysics::~IPhysics()46 PhysicsInterface::~PhysicsInterface () 45 47 { 46 48 // delete what has to be deleted here 47 49 } 48 50 49 void IPhysics::recalcMass()51 void PhysicsInterface::recalcMass() 50 52 { 51 53 float massSum = 0; … … 55 57 while( pn != NULL) 56 58 { 57 // todo: find out if children are IPhysicsin an efficient way58 if (strcmp( pn->getClassName(), " IPhysics")) {59 massSum += (( IPhysics*)pn)->getTotalMass();59 // todo: find out if children are PhysicsInterface in an efficient way 60 if (strcmp( pn->getClassName(), "PhysicsInterface")) { 61 massSum += ((PhysicsInterface*)pn)->getTotalMass(); 60 62 } 61 63 pn = iterator->nextElement(); … … 65 67 if (massSum != this->massChildren ) { 66 68 this->massChildren = massSum; 67 if (strcmp( parent->getClassName(), " IPhysics"))68 (( IPhysics*)parent)->recalcMass();69 if (strcmp( parent->getClassName(), "PhysicsInterface")) 70 ((PhysicsInterface*)parent)->recalcMass(); 69 71 } else { 70 72 this->massChildren = massSum; … … 73 75 74 76 75 void IPhysics::addForce( Vector force )77 void PhysicsInterface::addForce( Vector force ) 76 78 { 77 79 forceSum += force; 78 80 } 79 81 80 void IPhysics::addForce(Vector force, Vector grip)82 void PhysicsInterface::addForce(Vector force, Vector grip) 81 83 { 82 84 // add central force … … 86 88 } 87 89 88 void IPhysics::tick( float dt )90 void PhysicsInterface::tick( float dt ) 89 91 { 90 92 Vector acc = forceSum / ( massChildren + mass );
Note: See TracChangeset
for help on using the changeset viewer.