AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
UniformGravityField.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#ifndef AGX_UNIFORMGRAVITYFIELD_H
18#define AGX_UNIFORMGRAVITYFIELD_H
19
20#include <agx/GravityField.h>
21
22#include <agxData/Value.h>
23
24namespace agx
25{
27
33 {
34 public:
40
42 void setGravity( const Vec3& gravity );
43
45 Vec3 getGravity( ) const;
46
51 virtual Vec3 calculateGravity( const Vec3& position ) const override;
52
54 virtual Task* createRigidBodyTask() override;
55
57 virtual Task* createParticleSystemTask() override;
58
59
60 protected:
62
64
65 private:
67 };
68
69
71
73 {
74 return m_gravity->get();
75 }
76
77 inline void UniformGravityField::setGravity( const Vec3& gravity )
78 {
79 m_gravity->set(gravity);
80 }
81
83 {
84 return m_gravity->get();
85 }
86} //namespace agx
87#endif
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
#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
Only use as member allocated variable.
Definition Value.h:285
void set(const T &value)
Definition Value.h:441
const T & get() const
Definition Value.h:454
The class GravityField is responsible for calculating and applying a gravity force on a set of bodies...
A representation of a generic task.
Definition Task.h:58
The class UniformGravityField calculates a gravity which is uniform in magnitude over the entire spac...
virtual Vec3 calculateGravity(const Vec3 &position) const override
UniformGravityField(Vec3 gravity=Vec3(0, 0, -agx::GRAVITY_ACCELERATION))
Constructor.
virtual Task * createRigidBodyTask() override
Internal use.
void setGravity(const Vec3 &gravity)
Set the gravity vector.
virtual Task * createParticleSystemTask() override
Internal use.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
const Real GRAVITY_ACCELERATION
Definition Math.h:52