Changeset 4397 in orxonox.OLD for orxonox/trunk/src/lib/physics
- Timestamp:
- May 30, 2005, 4:57:04 PM (20 years ago)
- Location:
- orxonox/trunk/src/lib/physics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/physics/physics_interface.cc
r4396 r4397 36 36 \brief standard constructor 37 37 */ 38 PhysicsInterface::PhysicsInterface ( )38 PhysicsInterface::PhysicsInterface (void* objectPointer) 39 39 { 40 this->objectPointer = objectPointer; 41 40 42 // this->setClassName ("PhysicsInterface"); 41 43 this->mass = 1; … … 90 92 void PhysicsInterface::applyField(Field* field) 91 93 { 92 this->forceSum += field->calcForce(dynamic_cast<PNode*>(this)->getAbsCoor()); 94 PNode* tmp = (PNode*) objectPointer; 95 this->forceSum += field->calcForce(tmp->getAbsCoor()); 93 96 } 94 97 95 98 void PhysicsInterface::tickPhys( float dt ) 96 99 { 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 100 // Vector acc = this->forceSum / ( this->massChildren + this->mass ); 101 PNode* coorTick = (PNode*)(this->objectPointer); 102 if (coorTick) 103 coorTick->setRelCoor(coorTick->getRelCoor() + this->forceSum/this->mass * dt); 101 104 this->forceSum = Vector(0,0,0); 102 105 // todo: introduce kinematics -
orxonox/trunk/src/lib/physics/physics_interface.h
r4395 r4397 9 9 #include "vector.h" 10 10 #include "base_object.h" 11 12 #ifndef NULL 13 #define NULL 0 14 #endif 11 15 12 16 // Forward Declaration … … 26 30 27 31 public: 28 PhysicsInterface( );32 PhysicsInterface(void* objectPointer); 29 33 virtual ~PhysicsInterface(); 30 34 /** \param mass the mass to set for this node. */ … … 43 47 44 48 private: 49 void* objectPointer; 45 50 float mass; //!< Mass of this object 46 51 float massChildren; //!< Sum of the masses of the children nodes
Note: See TracChangeset
for help on using the changeset viewer.