48 Real getGravity( )
const;
52 Vec3 getCenter( )
const;
59 virtual Vec3 calculateGravity(
const Vec3& position )
const override;
82 Vec3 pos = m_center->get() - position;
85 return pos * m_gravity->
get();
90 return m_gravity->
get();
95 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
Templated value-reference.
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 ...
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 Task * createRigidBodyTask() override
Internal use.
virtual ~PointGravityField()
virtual Vec3 calculateGravity(const Vec3 &position) const override
Given position, a gravity acceleration will be calculated and returned.
virtual Task * createParticleSystemTask() override
Internal use.
A representation of a generic task.
Real normalize()
Normalize the vector so that it has length unity.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
static constexpr Real GRAVITY_ACCELERATION