Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 30, 2005, 4:57:04 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: ok… forces now apply to the right objects, but i don't really like the way it works…. we will see….

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/physics/physics_interface.cc

    r4396 r4397  
    3636   \brief standard constructor
    3737*/
    38 PhysicsInterface::PhysicsInterface ()
     38PhysicsInterface::PhysicsInterface (void* objectPointer)
    3939{
     40  this->objectPointer = objectPointer;
     41
    4042  //   this->setClassName ("PhysicsInterface");
    4143   this->mass = 1;
     
    9092void PhysicsInterface::applyField(Field* field)
    9193{
    92   this->forceSum += field->calcForce(dynamic_cast<PNode*>(this)->getAbsCoor());
     94  PNode* tmp = (PNode*) objectPointer;
     95  this->forceSum += field->calcForce(tmp->getAbsCoor()); 
    9396}
    9497
    9598void PhysicsInterface::tickPhys( float dt )
    9699{
    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);
    101104  this->forceSum = Vector(0,0,0);
    102105  // todo: introduce kinematics
Note: See TracChangeset for help on using the changeset viewer.