17 #ifndef AGX_POINTGRAVITYFIELD_H
18 #define AGX_POINTGRAVITYFIELD_H
50 Real getGravity( )
const;
61 virtual Vec3 calculateGravity(
const Vec3& position )
const override;
84 Vec3 pos = m_center->get() - position;
87 return pos * m_gravity->
get();
92 return m_gravity->
get();
97 return m_center->get();
#define AGX_DECLARE_POINTER_TYPES(type)
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGXPHYSICS_EXPORT
The class GravityField is responsible for calculating and applying a gravity force on a set of bodies...
The class PointGravityField calculates a gravity which is uniform in magnitude over the entire space ...
virtual Task * createParticleSystemTask() override
Internal use.
virtual Task * createRigidBodyTask() override
Internal use.
PointGravityField(const Vec3 ¢er=Vec3(), Real gravityMagnitude=agx::GRAVITY_ACCELERATION)
Constructor.
void setGravity(const Real gravityMagnitude)
Set the gravity direction/magnitude.
void setCenter(const Vec3 ¢er)
virtual ~PointGravityField()
virtual Vec3 calculateGravity(const Vec3 &position) const override
Given position, a gravity acceleration will be calculated and returned.
A representation of a generic task.
Real normalize()
Normalize the vector so that it has length unity.
AGXMODEL_EXPORT agx::Vec3 getCenter(const agxCollide::Mesh::Triangle &triangle)
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Vec3T< Real > Vec3
The object holding 3 dimensional vectors and providing basic arithmetic.
const Real GRAVITY_ACCELERATION