Changeset 7676 for code/trunk/src/modules/objects/ForceField.h
- Timestamp:
- Nov 26, 2010, 8:44:48 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/objects/ForceField.h
r7674 r7676 33 33 */ 34 34 35 /**36 @file ForceField.h37 @brief Definition of the ForceField class.38 @inGroup Objects39 */40 41 35 #ifndef _ForceField_H__ 42 36 #define _ForceField_H__ … … 53 47 @brief 54 48 The mode of the ForceField. 55 56 @in Group Objects49 50 @ingroup Objects 57 51 */ 58 52 namespace forceFieldMode … … 61 55 tube, //!< The ForceField has a tube shape. 62 56 sphere //!< The ForceField has a spherical shape. 63 64 57 }; 65 58 } … … 68 61 @brief 69 62 Implements a force field, that applies a force to any @ref orxonox::MoblieEnity "MobileEntity" that enters its range. 70 63 71 64 The following parameters can be set to specify the behavior of the ForceField. 72 - @b velocity The amount of force the ForceField excerts. 73 - @b diameter The diameter of the ForceField. 74 - @b length The length of the ForceField. 65 - @b velocity The amount of force the ForceField excerts. Default is 100. 66 - @b diameter The diameter of the ForceField. Default is 500. 67 - @b length The length of the ForceField. Default is 2000. 75 68 - @b mode The mode the ForceField is in. For mode: 76 -- <em>tube</em> A ForceField which exerts force only in the direction it is oriented. The force is only exerted on objects that are in a tube of length <em>length</em> and diameter <em>diameter</em>. The magintude of the force is proportional to the <em><velocity/em>, being highest when an object is in the middle of the tube (radius-wise), linearly decreasing with greater radii and finally reaching zero, when the object is <code>diameter/2</code> away from the orientation vector. 77 -- <em>sphere</em> A Force Field which exerts force radially away from itself, with the greatest magnitude (proportional to <em>velocity</em>) being in the origin of the ForceField, linearly decreasing with respect to the distance to the origin and finally reaching zero at distance <code>diameter/2</code>. 78 69 - <em>tube</em> A ForceField which exerts force only in the direction it is oriented. The force is only exerted on objects that are in a tube of length <em>length</em> and diameter <em>diameter</em>. The magintude of the force is proportional to the <em>velocity</em>, being highest when an object is in the middle of the tube (radius-wise), linearly decreasing with greater radii and finally reaching zero, when the object is <code>diameter/2</code> away from the orientation vector. 70 - <em>sphere</em> A Force Field which exerts force radially away from itself, with the greatest magnitude (proportional to <em>velocity</em>) being in the origin of the ForceField, linearly decreasing with respect to the distance to the origin and finally reaching zero at distance <code>diameter/2</code>. 71 Default is <em>tube</em>. 72 79 73 @author 80 74 Aurelian Jaggi 81 75 82 76 @author 83 77 Damian 'Mozork' Frick 84 85 @in Group Objects78 79 @ingroup Objects 86 80 */ 87 81 class _ObjectsExport ForceField : public StaticEntity, public Tickable … … 90 84 ForceField(BaseObject* creator); 91 85 virtual ~ForceField(); 92 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);93 virtual void tick(float dt);94 86 87 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Creates a ForceField object through XML. 88 virtual void tick(float dt); //!< A method that is called every tick. 89 90 /** 91 @brief Set the velocity of the ForceField. 92 @param vel The velocity to be set. 93 */ 95 94 inline void setVelocity(float vel) 96 95 { this->velocity_ = vel; } 97 96 /** 97 @brief Get the velocity of the ForceField. 98 @return Returns the velocity of the ForceField. 99 */ 98 100 inline float getVelocity() 99 101 { return this->velocity_; } 100 102 103 /** 104 @brief Set the diameter of the ForceField. 105 @param diam The diameter to be set. 106 */ 101 107 inline void setDiameter(float diam) 102 { this->diameter_ = diam; this->radius_ = diam/2; } 108 { this->radius_ = diam/2; } 109 /** 110 @brief Get the diameter of the ForceField. 111 @return Returns the diameter of the ForceField. 112 */ 113 inline float getDiameter() 114 { return this->radius_*2; } 103 115 104 inline float getDiameter() 105 { return this->diameter_; } 116 /** 117 @brief Set the length of the ForceField. 118 @param l The length to be set. 119 */ 120 inline void setLength(float l) 121 { this->halfLength_ = l/2; } 122 /** 123 @brief Get the length of the ForceField. 124 @return Returns the length of the ForceField. 125 */ 126 inline float getLength() 127 { return this->halfLength_*2; } 106 128 107 inline void setLength(float l) 108 { this->length_ = l; this->halfLength_ = l/2; } 109 110 inline float getLength() 111 { return this->length_; } 112 113 void setMode(const std::string& mode); 114 115 inline const std::string& getMode(void); 129 void setMode(const std::string& mode); //!< Set the mode of the ForceField. 130 const std::string& getMode(void); //!< Get the mode of the ForceField. 116 131 117 132 private: 133 //! Strings to represent the modes. 118 134 static const std::string modeTube_s; 119 135 static const std::string modeSphere_s; 120 121 float velocity_; 122 float diameter_; 123 float radius_; 124 float length_; 125 float halfLength_; 126 forceFieldMode::Value mode_; 136 137 float velocity_; //!< The velocity of the ForceField. 138 float radius_; //!< The radius of the ForceField. 139 float halfLength_; //!< Half of the length of the ForceField. 140 forceFieldMode::Value mode_; //!< The mode of the ForceField. 127 141 }; 128 142 } 129 143 130 144 #endif 131
Note: See TracChangeset
for help on using the changeset viewer.