Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5257 in orxonox.OLD for trunk/src/lib/physics/physics_interface.cc


Ignore:
Timestamp:
Sep 25, 2005, 7:04:28 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: bouncy effect with physically based animations… or something like it at least.

File:
1 edited

Legend:

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

    r5255 r5257  
    9999}
    100100
     101void PhysicsInterface::applyForce(const Vector& force)
     102{
     103  PNode* tmp = dynamic_cast<PNode*>((BaseObject*)this);
     104  this->forceSum += force;
     105  this->bForceApplied = true;
     106}
     107
    101108/**
    102109 *  ticks the PhysicsEffect
     
    107114  //  Vector acc = this->forceSum / ( this->massChildren + this->mass );
    108115  PNode* coorTick =  dynamic_cast<PNode*>((BaseObject*)this);
    109   if (this->bForceApplied && coorTick)
     116  if (coorTick != NULL )
     117    coorTick->shiftCoor((coorTick->getVelocity()+ this->forceSum/this->mass*dt)*dt);
     118
     119  if (this->bForceApplied)
    110120  {
    111     coorTick->shiftCoor((coorTick->getVelocity()+ this->forceSum/this->mass * dt)*dt);
    112 
    113121    this->bForceApplied = false;
     122    this->forceSum = Vector(0,0,0);
    114123  }
    115   this->forceSum = Vector(0,0,0);
    116124}
Note: See TracChangeset for help on using the changeset viewer.