60 template<
typename FuncT,
typename... Args>
61 static void preCollide( FuncT callback,
agxSDK::Simulation* simulation, Args&&... args );
69 template<
typename FuncT,
typename... Args>
78 template<
typename FuncT,
typename... Args>
87 template<
typename FuncT,
typename... Args>
126 using Callback = std::function<void()>;
139 static void registerCallback( Callback callback, CallbackType callbackType,
agxSDK::Simulation* simulation );
151 void executeCallbacks(
const agx::TimeStamp& t, CallbackType callbackType );
154 static InstanceType s_instances;
155 Callbacks m_callbacks;
158 template<
typename FuncT,
typename... Args>
161 if ( simulation ==
nullptr )
164 registerCallback( std::bind( callback, simulation, std::forward<Args>( args )... ), PRE_COLLIDE_TYPE, simulation );
167 template<
typename FuncT,
typename... Args>
170 if ( simulation ==
nullptr )
173 registerCallback( std::bind( callback, simulation, std::forward<Args>( args )... ), PRE_TYPE, simulation );
176 template<
typename FuncT,
typename... Args>
179 if ( simulation ==
nullptr )
182 registerCallback( std::bind( callback, simulation, std::forward<Args>( args )... ), POST_TYPE, simulation );
185 template<
typename FuncT,
typename... Args>
188 if ( simulation ==
nullptr )
191 registerCallback( std::bind( callback, simulation, std::forward<Args>( args )... ), LAST_TYPE, simulation );
#define AGXPHYSICS_EXPORT
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Derive from this class to implement a listener for simulation step events.
Helper to use lambdas as preCollide, pre, post and last step events.
virtual void addNotification() override
Add notification callback.
static void pre(FuncT callback, agxSDK::Simulation *simulation, Args &&... args)
Register a pre step event callback.
virtual ~StepEventCallback()
Reference counted object, protected destructor.
virtual void last(const agx::TimeStamp &t) override
Called after a step is taken in the simulation Implement this method in the derived class to get call...
static void post(FuncT callback, agxSDK::Simulation *simulation, Args &&... args)
Register a post step event callback.
static void preCollide(FuncT callback, agxSDK::Simulation *simulation, Args &&... args)
Register a pre-collide step event callback.
virtual void pre(const agx::TimeStamp &t) override
Called before a step is taken in the simulation Implement this method in the derived class to get cal...
virtual void post(const agx::TimeStamp &t) override
Called after a step is taken in the simulation Implement this method in the derived class to get call...
virtual void removeNotification() override
Remove notification callback - will unregister this from the static instances.
static void last(FuncT callback, agxSDK::Simulation *simulation, Args &&... args)
Register a last step event callback.
virtual void preCollide(const agx::TimeStamp &t) override
Called before collision detection is performed in the simulation Implement this method in the derived...
static void uninitialize(agxSDK::Simulation *simulation)
Removes internal step event listener from the simulation (if created).
Inheritance with partial specialization due to bug with ref_ptr containers.
Smart pointer for handling referenced counted objects.
The agxUtil namespace contain classes and methods for utility functionality.