40 #ifndef _fieldofforce_cpp
41 #define _fieldofforce_cpp
43 #include "fieldofforce.h"
45 #include "Physics/rigidproxy.h"
46 #include "Physics/ghostproxy.h"
99 {
return Mezzanine::WO_AreaEffectFieldOfForce; }
113 Real Distance, AppliedStrength;
117 (*ObjIt)->GetProxies(Mezzanine::PT_Physics_RigidProxy,RigidProxies);
118 if( RigidProxies.empty() )
121 ObjectLoc = (*ObjIt)->GetLocation();
149 if(0 > AppliedStrength)
153 for(
ProxyIterator ProxIt = RigidProxies.begin() ; ProxIt != RigidProxies.end() ; ++ProxIt )
234 if( !PropertiesNode.
Empty() ) {
236 CurrAttrib = PropertiesNode.
GetAttribute(
"AttenAmount");
237 if( !CurrAttrib.
Empty() )
241 if( !CurrAttrib.
Empty() )
245 if( !CurrAttrib.
Empty() )
249 if( !AttenSourceNode.
Empty() ) {
250 Vector3 Source(AttenSourceNode);
255 if( !DirectionNode.
Empty() ) {
271 {
return "FieldOfForce"; }
301 {
delete ToBeDestroyed; }
This is the base class for all collision shapes.
Attribute AppendAttribute(const Char8 *Name)
Creates an Attribute and puts it at the end of this Nodes attributes.
A light-weight handle for manipulating attributes in DOM tree.
virtual Mezzanine::AttenuationStyle GetAttenuationStyle() const
Gets the method of attenuation of force over a distance.
virtual void ApplyForce(const Vector3 &Force)
Push/Apply force to an proxy.
virtual void ApplyEffect()
FieldOfForceFactory()
Class constructor.
virtual Vector3 GetDirectionOfForce() const
Gets the currenly set direction force is to be applied.
virtual void ProtoDeSerializeProperties(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the properties of this object with it...
virtual String GetTypeName() const
Real Strength
The amount of force exerted on other objects.
Quadratic/Exponential Attentuation, similar to real gravity, it tapers of more the further from the c...
virtual AreaEffect * CreateAreaEffect(const String &Name, World *TheWorld, const NameValuePairMap &Params)
virtual ~FieldOfForceFactory()
Class destructor.
ObjectContainer::iterator ObjectIterator
Iterator type for Object instances stored by this class.
Thrown when the requested identity could not be found.
Node GetFirstChild() const
Get the first child Node of this Node.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
Thrown when a version is accessed/parsed/required and it cannot work correctly or is missing...
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
ObjectContainer OverlappingObjects
Container for actors within the field area.
No Attentuation, Equal strength through.
virtual Vector3 GetAttenuationSource() const
Gets the source of the force for calculating attenuation.
bool Empty() const
Is this storing anything at all?
This implements the exception hiearchy for Mezzanine.
Mezzanine::AttenuationStyle AttenStyle
How gravity weakens over distance, if at all.
Real Distance(const Vector3 &OtherVec) const
Gets the distance between this and another vector.
Linear attentuation, Strength weaker farther from center.
float Real
A Datatype used to represent a real floating point number.
The interface for serialization.
std::vector< WorldProxy * > ProxyContainer
Basic container type for WorldProxy storage by this class.
bool SetValue(const Char8 *rhs)
Set the value of this.
This class is used to define area's in the world that have unique effects.
This is field that applies force in a direction, and doesn't tamper with gravity. ...
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
virtual Mezzanine::WorldObjectType GetType() const
Gets the type of the object instance.
Whole AsWhole(Whole def=0) const
Attempts to convert the value of the attribute to a Whole and returns the results.
A light-weight handle for manipulating nodes in DOM tree.
virtual void SetFieldStrength(const Real FieldStrength)
Sets the strenth of the field.
virtual FieldOfForce * CreateFieldOfForce(const String &Name, World *TheWorld)
Creates a FieldOfForce object.
int AsInt(int def=0) const
Attempts to convert the value of the attribute to an int and returns the results. ...
virtual void ProtoDeSerializeProperties(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the properties of this object with it...
virtual void DestroyAreaEffect(AreaEffect *ToBeDestroyed)
bool Empty() const
Is this storing anything at all?
Real AsReal(Real def=0) const
Attempts to convert the value of the attribute to a Real and returns the results. ...
virtual Real GetAttenuationAmount() const
Gets the amount of force that is attenuated over distance.
static String GetSerializableName()
Get the name of the the XML tag the proxy class will leave behind as its instances are serialized...
virtual Real GetFieldStrength() const
Gets the strength of the field.
This is a proxy from which rigid body proxys are handled.
virtual ~FieldOfForce()
Class destructor.
virtual void SetDirectionOfForce(const Vector3 &ForceDirection)
Sets the direction force is to be applied within this field.
ProxyContainer::iterator ProxyIterator
Iterator type for WorldProxy instances stored by this class.
This is used to represent a point in space, or a vector through space.
Vector3 Direction
The direction the force is applied.
WorldObjectType
Used by various classes to help identify what class an object is.
The bulk of the engine components go in this namspace.
virtual void SetAttenuationAmount(const Real Amount)
Sets the amount of force that is attenuated over distance.
This class represents a world for objects to interact within.
virtual void SetAttenuation(const Real Amount, const Mezzanine::AttenuationStyle Style, const Vector3 &Source)
Sets the attenuation for this field.
virtual String GetDerivedSerializableName() const
Gets the most derived serializable name of this WorldObject.
virtual void SetAttenuationSource(const Vector3 &Source)
Sets the source of the force for calculating attenuation.
FieldOfForce(World *TheWorld)
Blank constructor.
Vector3 AttenSource
The user defined source if enabled.
void SerializeError(const String &FailedTo, const String &ClassName, Boole SOrD)
Simply does some string concatenation, then throws an Exception.
virtual void ProtoDeSerialize(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite this object with it.
Node AppendChild(NodeType Type=NodeElement)
Creates a Node and makes it a child of this one.
std::map< String, String > NameValuePairMap
This is a datatype mostly used for describing settings or parameters that can't be declared in advanc...
std::string String
A datatype used to a series of characters.
Real AttenAmount
How much the Gravity weakens over distance.
AttenuationStyle
These values represent the kind of attenuation applied to the field strength over a distance...
Attribute GetAttribute(const Char8 *Name) const
Attempt to get an Attribute on this Node with a given name.
virtual void SetAttenuationStyle(const Mezzanine::AttenuationStyle Style)
Sets the method of attenuation of force over a distance.
void ProtoSerialize(XML::Node &CurrentRoot) const
Convert this class to an XML::Node ready for serialization.
Node GetChild(const Char8 *Name) const
Attempt to get a child Node with a given name.