Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4397 in orxonox.OLD for orxonox/trunk/src/lib/physics


Ignore:
Timestamp:
May 30, 2005, 4:57:04 PM (20 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….

Location:
orxonox/trunk/src/lib/physics
Files:
2 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
  • orxonox/trunk/src/lib/physics/physics_interface.h

    r4395 r4397  
    99#include "vector.h"
    1010#include "base_object.h"
     11
     12#ifndef NULL
     13#define NULL 0
     14#endif
    1115
    1216// Forward Declaration
     
    2630
    2731 public:
    28   PhysicsInterface();
     32  PhysicsInterface(void* objectPointer);
    2933  virtual ~PhysicsInterface();
    3034  /** \param mass the mass to set for this node. */
     
    4347 
    4448 private:
     49  void* objectPointer;
    4550  float mass;                   //!< Mass of this object
    4651  float massChildren;           //!< Sum of the masses of the children nodes
Note: See TracChangeset for help on using the changeset viewer.