Changeset 4396 in orxonox.OLD for orxonox/trunk/src/lib/physics
- Timestamp:
- May 30, 2005, 3:27:36 PM (19 years ago)
- Location:
- orxonox/trunk/src/lib/physics
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/physics/fields/gravity.cc
r4395 r4396 47 47 Vector Gravity::calcForce(const Vector& data) const 48 48 { 49 return /*(this->getAbsDir().apply(Vector(0,1,0)))*/Vector(0,-1,0) * this->getMagnitude();49 return Vector(0,-1,0) * this->getMagnitude(); 50 50 } 51 51 -
orxonox/trunk/src/lib/physics/physics_engine.cc
r4395 r4396 140 140 void PhysicsEngine::tick(float dt) 141 141 { 142 tIterator<PhysicsConnection>* it erator= this->connections->getIterator();143 PhysicsConnection* enum Conn = iterator->nextElement();144 while (enum Conn)142 tIterator<PhysicsConnection>* itPC = this->connections->getIterator(); 143 PhysicsConnection* enumPC = itPC->nextElement(); 144 while (enumPC) 145 145 { 146 enum Conn->apply();147 enum Conn = iterator->nextElement();146 enumPC->apply(); 147 enumPC = itPC->nextElement(); 148 148 } 149 delete iterator; 149 delete itPC; 150 151 152 tIterator<PhysicsInterface>* itPI = this->interfaces->getIterator(); 153 PhysicsInterface* enumPI = itPI->nextElement(); 154 while (enumPI) 155 { 156 enumPI->tickPhys(dt); 157 enumPI = itPI->nextElement(); 158 } 159 delete itPI; 150 160 } 151 161 -
orxonox/trunk/src/lib/physics/physics_interface.cc
r4395 r4396 39 39 { 40 40 // this->setClassName ("PhysicsInterface"); 41 this->mass = 0;41 this->mass = 1; 42 42 this->massChildren = 0; 43 43 this->forceSum = Vector(0, 0, 0); … … 90 90 void PhysicsInterface::applyField(Field* field) 91 91 { 92 // this->forceSum += force;92 this->forceSum += field->calcForce(dynamic_cast<PNode*>(this)->getAbsCoor()); 93 93 } 94 94 … … 96 96 { 97 97 Vector acc = this->forceSum / ( this->massChildren + this->mass ); 98 PNode* coorTick = (PNode*) this; 99 coorTick->setRelCoor(coorTick->getRelCoor() + (this->forceSum / this->mass * dt)); 100 101 this->forceSum = Vector(0,0,0); 98 102 // todo: introduce kinematics 99 103 }
Note: See TracChangeset
for help on using the changeset viewer.