AGX Dynamics 2.41.2.0
Loading...
Searching...
No Matches
StepEventListener.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. 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#pragma once
18
19#include <agxSDK/agxSDK.h>
20
22#include <agx/TimeStamp.h>
23
24namespace agxSDK
25{
38 {
39 public:
40
43 STEP_NONE = 0x0,
44 PRE_COLLIDE = 0x1,
45 PRE_STEP = 0x2,
46 POST_STEP = 0x4,
47 LAST_STEP = 0x8,
48 DEFAULT = PRE_STEP | POST_STEP,
49 ALL = PRE_COLLIDE | PRE_STEP | POST_STEP | LAST_STEP
50 };
51
53 StepEventListener( int mask = DEFAULT );
54
59 virtual void setMask(int mask) override;
60
61
62 // ================ Override these three methods to catch events
68 virtual void preCollide(const agx::TimeStamp& time);
69
75 virtual void pre(const agx::TimeStamp& time);
76
82 virtual void post(const agx::TimeStamp& time);
83
90 virtual void last(const agx::TimeStamp& time);
91
92#ifndef SWIG
94#endif
95
96 protected:
97
98
101 };
102
103
104
105 inline void StepEventListener::preCollide(const agx::TimeStamp& /*time*/) { }
106 inline void StepEventListener::pre(const agx::TimeStamp& /*time*/) { }
107 inline void StepEventListener::post(const agx::TimeStamp& /*time*/) { }
108 inline void StepEventListener::last(const agx::TimeStamp& /*time*/) { }
109
110
111}
#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...
Definition: Serializable.h:208
#define AGXPHYSICS_EXPORT
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: agx/Vector.h:34
An EventListener can be associated to a Simulation and triggered upon various events.
Definition: EventListener.h:40
Derive from this class to implement a listener for simulation step events.
virtual void preCollide(const agx::TimeStamp &time)
Called before collision detection is performed in the simulation Implement this method in the derived...
virtual ~StepEventListener()
Destructor.
virtual void last(const agx::TimeStamp &time)
Called after a step is taken in the simulation Implement this method in the derived class to get call...
virtual void pre(const agx::TimeStamp &time)
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 &time)
Called after a step is taken in the simulation Implement this method in the derived class to get call...
ActivationMask
Defines the event states for which a listener will be activated, a mask can be bitwise OR:ed from the...
StepEventListener(int mask=DEFAULT)
Default constructor, sets the default activation mask to all (POST_STEP and PRE_STEP) events.
virtual void setMask(int mask) override
Specifies a bitmask which determines which event types will activate this listener.
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:31
agx::Real TimeStamp
Definition: TimeStamp.h:26