- Timestamp:
- May 10, 2009, 10:49:36 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gametypes/src/orxonox/objects/worldentities/ForceField.cc
r2954 r2961 43 43 //Standard Values 44 44 this->setDirection(Vector3::ZERO); 45 velocity_ = 100 0;45 velocity_ = 100; 46 46 diameter_ = 500; 47 length_ = 1000;47 length_ = 2000; 48 48 } 49 49 … … 57 57 58 58 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); 61 61 } 62 62 63 63 void ForceField::tick(float dt) 64 64 { 65 65 66 for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it) 66 67 { 68 67 69 //calculate from 68 70 Vector3 directionVec = this->getOrientation() * WorldEntity::FRONT; … … 77 79 { 78 80 //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_); 81 82 } 82 83
Note: See TracChangeset
for help on using the changeset viewer.