Index: code/trunk/src/modules/objects/ForceField.cc
===================================================================
--- code/trunk/src/modules/objects/ForceField.cc	(revision 8394)
+++ code/trunk/src/modules/objects/ForceField.cc	(revision 8397)
@@ -23,5 +23,5 @@
  *      Aurelian Jaggi
  *   Co-authors:
- *      ...
+ *      Kevin Young
  *
  */
@@ -45,4 +45,7 @@
     /*static*/ const std::string ForceField::modeSphere_s = "sphere";
     /*static*/ const std::string ForceField::modeInvertedSphere_s = "invertedSphere";
+    /*static*/ const std::string ForceField::modeNewtonianGravity_s = "newtonianGravity";
+    /*static*/ const float ForceField::gravConstant_ = 6.673e-11;
+    /*static*/ const float ForceField::attenFactor_ = 1;
 
     /**
@@ -58,4 +61,5 @@
         this->setVelocity(100);
         this->setDiameter(500);
+        this->setMassDiameter(0);   //! We allow point-masses
         this->setLength(2000);
         this->mode_ = forceFieldMode::tube;
@@ -82,4 +86,5 @@
         XMLPortParam(ForceField, "velocity", setVelocity, getVelocity, xmlelement, mode).defaultValues(100);
         XMLPortParam(ForceField, "diameter", setDiameter, getDiameter, xmlelement, mode).defaultValues(500);
+        XMLPortParam(ForceField, "massDiameter", setMassDiameter, getMassDiameter, xmlelement, mode).defaultValues(0);
         XMLPortParam(ForceField, "length", setLength  , getLength  , xmlelement, mode).defaultValues(2000);
         XMLPortParam(ForceField, "mode", setMode, getMode, xmlelement, mode);
@@ -90,4 +95,5 @@
         registerVariable(this->velocity_, VariableDirection::ToClient);
         registerVariable(this->radius_, VariableDirection::ToClient);
+        registerVariable(this->massRadius_, VariableDirection::ToClient);
         registerVariable(this->halfLength_, VariableDirection::ToClient);
         registerVariable(this->mode_, VariableDirection::ToClient);
@@ -98,5 +104,5 @@
     @brief
         A method that is called every tick.
-        Implements the behavior of teh ForceField.
+        Implements the behavior of the ForceField.
     @param dt
         The amount of time that elapsed since the last tick.
@@ -165,4 +171,29 @@
             }
         }
+        else if(this->mode_ == forceFieldMode::newtonianGravity)
+        {
+            // Iterate over all objects that could possibly be affected by the ForceField.
+            for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
+            {
+                Vector3 distanceVector = it->getWorldPosition() - this->getWorldPosition();
+                float distance = distanceVector.length();
+                // If the object is within 'radius' distance and especially further away than massRadius_
+                if (distance < this->radius_ && distance > this->massRadius_)
+                {
+                    distanceVector.normalise();
+                    /* Apply a central force that follows the newtownian law of gravity, ie.:
+                     * F = G * (M*m) / D^2,
+                     * while M is the mass of the stellar body and m is the mass of the affected object. 
+                     * D is the distance from the center of mass of both bodies
+                     * and it should be noted that massRadius_ denotes the radius of the stellar body,
+                     * at which point the force vanishes (you can use this to dictate the size of the body).
+                     * attenFactor_ weakens the field by a constant factor. The -1 is needed for an attractive force.
+                     */
+                    
+                    // Note: this so called force is actually an acceleration!
+                    it->applyCentralForce((-1) * (ForceField::attenFactor_ * ForceField::gravConstant_ * this->getMass()) / (distance * distance) * distanceVector);
+                }
+            }
+        }
     }
 
@@ -181,4 +212,6 @@
         else if(mode == ForceField::modeInvertedSphere_s)
             this->mode_ = forceFieldMode::invertedSphere;
+        else if(mode == ForceField::modeNewtonianGravity_s)
+            this->mode_ = forceFieldMode::newtonianGravity;
         else
         {
@@ -204,4 +237,6 @@
             case forceFieldMode::invertedSphere:
                 return ForceField::modeInvertedSphere_s;
+            case forceFieldMode::newtonianGravity:
+                return ForceField::modeNewtonianGravity_s;
             default:
                 return ForceField::modeTube_s;
Index: code/trunk/src/modules/objects/ForceField.h
===================================================================
--- code/trunk/src/modules/objects/ForceField.h	(revision 8394)
+++ code/trunk/src/modules/objects/ForceField.h	(revision 8397)
@@ -24,4 +24,5 @@
  *   Co-authors:
  *      Damian 'Mozork' Frick
+ *      Kevin Young
  *
  */
@@ -55,5 +56,6 @@
             tube, //!< The ForceField has a tube shape.
             sphere, //!< The ForceField has a spherical shape.
-            invertedSphere //!< The ForceField has a spherical shape but "inverted" behavior.
+            invertedSphere, //!< The ForceField has a spherical shape but "inverted" behavior.
+            newtonianGravity //!< The ForceField imitates Newtonian gravitation for use in stellar bodies.
         };
     }
@@ -106,5 +108,5 @@
 
             /**
-            @brief Set the diameter of the ForceField.
+            @brief Set the diameter of the ForceField. In mode StellarBody this stands for the outer radius.
             @param diam The diameter to be set.
             */
@@ -112,9 +114,23 @@
                 { this->radius_ = diam/2; }
             /**
-            @brief Get the diameter of the ForceField.
+            @brief Get the diameter of the ForceField. In mode StellarBody this stands for the outer radius.
             @return Returns the diameter of the ForceField.
             */
             inline float getDiameter()
                 { return this->radius_*2; }
+        
+            /**
+            @brief Set the diameter of the stellar body for the Newtonian ForceField.
+            @param massDiam The diameter of the stellar body.
+            */
+            inline void setMassDiameter(float massDiam)
+                { this->massRadius_ = massDiam/2; }
+        
+            /**
+            @brief Get the diameter of the stellar body for the Newtonian ForceField.
+            @return float Returns the diameter of the stellar body.
+            */
+            inline float getMassDiameter()
+                { return this->massRadius_*2; }
 
             /**
@@ -139,9 +155,16 @@
             static const std::string modeSphere_s;
             static const std::string modeInvertedSphere_s;
+            static const std::string modeNewtonianGravity_s;
 
             float velocity_; //!< The velocity of the ForceField.
             float radius_; //!< The radius of the ForceField.
+            float massRadius_; //!< The radius of the stellar body for the Newtonian ForceField.
             float halfLength_; //!< Half of the length of the ForceField.
             int mode_; //!< The mode of the ForceField.
+            
+            //! Gravitational constant for Newtonian ForceFields.
+            static const float gravConstant_;
+            //! Attenuation factor for Newtonian ForceFields
+            static const float attenFactor_;
   };
 }
