AGXDynamics
2.35.0.3
LuaScriptOperation.h
Go to the documentation of this file.
1
/*
2
Copyright 2007-2022. Algoryx Simulation AB.
3
4
All AGX source code, intellectual property, documentation, sample code,
5
tutorials, scene files and technical white papers, are copyrighted, proprietary
6
and confidential material of Algoryx Simulation AB. You may not download, read,
7
store, distribute, publish, copy or otherwise disseminate, use or expose this
8
material unless having a written signed agreement with Algoryx Simulation AB, or having been
9
advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10
valid commercial license from Algoryx Simulation AB.
11
12
Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13
from using this software, unless otherwise stated in written agreements with
14
Algoryx Simulation AB.
15
*/
16
17
#ifndef AGXLUA_LUASCRIPTOPERATION_H
18
#define AGXLUA_LUASCRIPTOPERATION_H
19
20
#include <agx/config/AGX_USE_LUA.h>
21
#include <fstream>
22
#include <
agxLua/export.h
>
23
#include <
agxControl/SensorEvent.h
>
24
#include <
agxControl/EventSensor.h
>
25
26
#if AGX_USE_LUA()
27
28
/*
29
This file defines some example sensor operations
30
*/
31
namespace
agxLua
32
{
37
AGX_DECLARE_POINTER_TYPES
(LuaScriptOperation);
38
class
AGXLUA_EXPORT
LuaScriptOperation :
public
agxControl::SensorOperation
39
{
40
public
:
41
42
LuaScriptOperation(
const
agx::Name
& name =
agx::Name
());
43
LuaScriptOperation(
const
agx::Name
& name,
const
agx::String
& script,
const
agx::String
& functionIdentifier=
""
);
44
45
virtual
void
triggerParticleEvent(
const
agx::TimeStamp
& t,
46
agxSDK::Simulation
* simulation,
47
agx::Physics::ParticleGeometryContactInstance contact,
48
agx::Physics::ParticleData& particleData,
49
agx::Physics::GeometryData& geometryData,
50
agxControl::EventSensor
* sensor)
override
;
51
52
virtual
void
triggerEvent(
const
agx::TimeStamp
& t,
53
agxSDK::Simulation
* simulation,
54
agxCollide::GeometryContact
* cd,
55
agxControl::EventSensor
* sensor)
override
;
56
57
virtual
void
postContactHandling(
agxSDK::Simulation
* simulation,
agxControl::EventSensor
*sensor)
override
;
58
59
void
doInit(
agxSDK::Simulation
* simulation);
60
61
AGXSTREAM_DECLARE_SERIALIZABLE
(agxLua::LuaScriptOperation);
62
63
protected
:
64
virtual
~LuaScriptOperation();
65
66
void
doErrorHandling(
const
agx::String
&
function
,
const
agx::String
& lastError);
67
68
protected
:
69
agx::String
m_script;
70
agx::String
m_functionIdentifier;
71
bool
m_initiated;
72
};
73
}
74
75
#endif
76
77
#endif
agxControl::SensorOperation
A specific type of sensor event that triggers a change in the simulation when activated by a contact.
Definition:
SensorEvent.h:117
export.h
AGXSTREAM_DECLARE_SERIALIZABLE
#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:207
AGXLUA_EXPORT
#define AGXLUA_EXPORT
Definition:
agxLua/export.h:42
agxControl::EventSensor
This is a sensor class that can be attached to an geometry in the simulation.
Definition:
EventSensor.h:47
agxSDK::Simulation
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition:
Simulation.h:126
agxLua
Definition:
castUtils.h:24
SensorEvent.h
agx::Name
Representation of a name string.
Definition:
Name.h:32
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition:
Referenced.h:248
agxCollide::GeometryContact
A contact between two geometries.
Definition:
Contacts.h:269
agx::TimeStamp
agx::Real TimeStamp
Definition:
TimeStamp.h:26
agx::AgXString
Definition:
String.h:31
EventSensor.h
include
agxLua
LuaScriptOperation.h
Generated on Fri Feb 10 2023 14:06:15 for AGXDynamics by
1.8.17