5
#include <dtGame/gamemanager.h>
6
#include <dtABC/application.h>
7
#include <dtCore/transform.h>
8
#include <dtCore/scene.h>
11
#include <srCore/body/bodyBase.h>
13
//TODO: scale function for scaling the object mesh.
19
std::string valueName;
20
std::string valueType;
25
//! Object base class.
29
* Handles general properties of the objects.
31
* @author Lutz Winkler
34
class ObjectBase : public dtCore::Object
41
* \param attachedTo Body, where the object is attached to
42
* \param translation Local position of the object
43
* \param orientation Local orientation of the object
44
* \param name name of the object
45
* \param type type of the object
48
ObjectBase( dtCore::RefPtr<BodyBase> attachedBody = NULL,
49
osg::Vec3f translation = osg::Vec3f(0,0,0), osg::Vec3f orientation= osg::Vec3f(0,0,0),
50
std::string name = "noName", std::string type = "noType",
53
//! Returns the name of the object
54
inline std::string getName() const {return name;};
56
//! Returns the type of the object
57
inline std::string getType() const {return type;};
59
//! Returns translation of the object - currently only local translation
60
osg::Vec3f getTranslation(dtCore::Transformable::CoordSysEnum cs = dtCore::Transformable::REL_CS);
62
//! Returns orientation of the object - currently only local orientation
63
virtual osg::Vec3f getOrientation(dtCore::Transformable::CoordSysEnum cs = dtCore::Transformable::REL_CS);
66
* \brief Writes the parameter value in parameter
68
* The available parameters can be retrieved by calling getParameterList()
70
* \param name name of the parameter
71
* \param parameter pointer where parameter value will be written to
74
* parameter is type of float, myHinge is instance of HingeActuator. The following program snippet writes the
75
* parameter value of "RelPosition" to parameter. getParameter() checks hereby if the type of parameter is valid.
77
* myHinge->getParameter("RelPosition", MAKE_PARAMETER_VALUE(¶meter));
81
virtual void getParameter(const std::string &name, ParameterReturnValue parameter);
84
* \brief Sets a parameter
86
* See also getParameter()
89
virtual void setParameter(const std::string &name, ParameterReturnValue parameter);
91
//! Returns the body, the object is attached to
92
inline dtCore::RefPtr<BodyBase> getAttachedBody() const {return myBody;};
94
//! Returns the parameter list. See also getParameter()
95
inline std::vector<Parameters> getParameterList() const {return myParameters;}
97
//! Activate/deactivate object. A deactivated object has no influence in the simulation
98
inline void setActive(bool activate) {active = activate;}
100
//! Returns true, if object is activated, else false.
101
inline bool isActive() const {return active;}
103
//! Will be called in RobotActorBase::TickLocal()
104
virtual void update(float deltaSimTme) {};
107
virtual ~ObjectBase();
109
void setName(std::string name) {this->name = name;};
110
void setType(std::string name) {this->type = type;};
111
virtual void attachToBody(dtCore::RefPtr<BodyBase> body) {myBody = body; };
113
std::vector<Parameters> myParameters;
114
std::string name, type;
115
osg::Vec3f relTranslation, relOrientation;
116
osg::Vec3f absTranslation, absOrientation;
117
dtCore::RefPtr<BodyBase> myBody;
123
#endif /*OBJECTBASE_H_*/