Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2961 for code/branches


Ignore:
Timestamp:
May 10, 2009, 10:49:36 PM (16 years ago)
Author:
Aurelian
Message:

Gametype Asteroids - ForceField working

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gametypes/src/orxonox/objects/worldentities/ForceField.cc

    r2954 r2961  
    4343      //Standard Values
    4444      this->setDirection(Vector3::ZERO);
    45       velocity_ = 1000;
     45      velocity_ = 100;
    4646      diameter_ = 500;
    47       length_ = 1000;
     47      length_ = 2000;
    4848    }
    4949
     
    5757
    5858      XMLPortParam(ForceField, "velocity", setVelocity, getVelocity, xmlelement, mode).defaultValues(100);
    59       XMLPortParam(ForceField, "diameter", setDiameter, getDiameter, xmlelement, mode).defaultValues(20);
    60       XMLPortParam(ForceField, "length"  , setLength  , getLength  , xmlelement, mode).defaultValues(500);
     59      XMLPortParam(ForceField, "diameter", setDiameter, getDiameter, xmlelement, mode).defaultValues(500);
     60      XMLPortParam(ForceField, "length"  , setLength  , getLength  , xmlelement, mode).defaultValues(2000);
    6161    }
    6262 
    6363    void ForceField::tick(float dt)
    6464    {
     65     
    6566      for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
    6667      {
     68       
    6769        //calculate from
    6870        Vector3 directionVec = this->getOrientation() * WorldEntity::FRONT;
     
    7779        {
    7880          //normalize distance from center
    79           it->applyCentralForce(((diameter_ / 2 - distFromCenterVec) / diameter_) * directionVec * velocity_);
    80                 COUT(0) << "Forfce aplied" << std::endl;
     81          it->applyCentralForce(((diameter_ / 2 - distFromCenterVec) / (diameter_ / 2)) * directionVec * velocity_);
    8182        }
    8283       
Note: See TracChangeset for help on using the changeset viewer.