AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
ContactEventListener.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#pragma once
18
19#include <agxSDK/agxSDK.h>
20
21#include <agxCollide/Geometry.h>
23
24#include <agx/TimeStamp.h>
25#include <agxCollide/Contacts.h>
26
28
29namespace agxSDK
30{
31
45 {
46 public:
47
50 IMPACT = 1 << 0,
51 CONTACT = 1 << 1,
52 SEPARATION = 1 << 2,
53 POST = 1 << 3,
54 DEFAULT = IMPACT | SEPARATION,
55 ALL = IMPACT | CONTACT | SEPARATION | POST
56 };
57
61 REMOVE_CONTACT,
64 REMOVE_CONTACT_IMMEDIATELY
66 };
67
69 virtual void setMask(int f);
70
76 ContactEventListener(int m = DEFAULT, ExecuteFilter* filter = nullptr );
77
78
79 //=================== Override these methods:
88 virtual KeepContactPolicy impact(const agx::TimeStamp& time, agxCollide::GeometryContact *geometryContact);
89
98 virtual KeepContactPolicy contact(const agx::TimeStamp& time, agxCollide::GeometryContact* geometryContact);
99
108 virtual void separation(const agx::TimeStamp& time, agxCollide::GeometryPair& geometryPair);
109
118 virtual void post(const agx::TimeStamp& time, agxCollide::GeometryContact* geometryContact);
119
120 //=================== End Override
121
123 void setFilter( ExecuteFilter* filter );
124
126 ExecuteFilter* getFilter( );
127
129 const ExecuteFilter* getFilter( ) const;
130
131 protected:
132
135
137 };
138
140
141
146
151
152 AGX_FORCE_INLINE void ContactEventListener::separation(const agx::TimeStamp&, agxCollide::GeometryPair&) {}
153
157
162
167
168}
#define AGXPHYSICS_EXPORT
A contact between two geometries.
Definition Contacts.h:271
Derive from this class to implement a listener for Collision events.
ContactEventListener(int m=DEFAULT, ExecuteFilter *filter=nullptr)
Default constructor, sets the activation mask by default to Impact and Separation.
ActivationMask
Defines the event states for which a listener will be activated, a mask can be bitwise OR:ed from the...
virtual void post(const agx::TimeStamp &time, agxCollide::GeometryContact *geometryContact)
Called before agxSDK::StepEventListener::post now that the geometry contacts has contact forces from ...
virtual void separation(const agx::TimeStamp &time, agxCollide::GeometryPair &geometryPair)
Called upon separation event if getFilter() contain SEPARATION.
void setFilter(ExecuteFilter *filter)
Replaces the current filter with a new one.
virtual ~ContactEventListener()
Destructor.
virtual void setMask(int f)
Specifies a bit mask which determines which event types that will activate this listener.
KeepContactPolicy
Defines whether contact should be kept or removed after contact/impact methods returns.
virtual KeepContactPolicy impact(const agx::TimeStamp &time, agxCollide::GeometryContact *geometryContact)
Called upon impact event if getFilter() contain IMPACT.
virtual KeepContactPolicy contact(const agx::TimeStamp &time, agxCollide::GeometryContact *geometryContact)
Called upon contact event if getFilter() contain CONTACT.
An EventListener can be associated to a Simulation and triggered upon various events.
Abstract base class that implements a filter that selects which events should trigger a Listener.
#define AGX_FORCE_INLINE
Definition macros.h:58
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition Constraint.h:31
agx::ref_ptr< ContactEventListener > ContactEventListenerRef
agx::Real TimeStamp
Definition TimeStamp.h:26