Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5257 in orxonox.OLD for trunk/src/lib


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.

Location:
trunk/src/lib/physics
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/physics/physics_connection.h

    r5039 r5257  
    11/*!
    22 * @file physics_connection.h
    3   *  Definition of The Physical Connection Class.
     3 *  Definition of The Physical Connection Class.
     4 * @todo
    45*/
    56
  • 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}
  • trunk/src/lib/physics/physics_interface.h

    r5143 r5257  
    3939  inline float getTotalMass( void ) const { return mass + massChildren; };
    4040
     41  virtual void applyForce(const Vector& force);
    4142  virtual void applyField(Field* field);
    4243  virtual void tickPhys( float dt );
Note: See TracChangeset for help on using the changeset viewer.