1
//! Specialized body class.
4
* Predefined body class. Ready to use in a RobotActor.
5
* This body represents the wheels of the robot.
11
#include <srBody/led.h>
16
/*! @param id a 16bit id, used to set the colliding bit parameter.
17
* @param x, y, z the position of the hinge in the world coordinate system.
18
* @param heading, pitch, roll the orientation of the axis of the hinge in the world coordinate system.
19
* @param Scene the scene in which the body should be placed.
22
Led::Led(dtCore::RefPtr<BodyBase> attachedBody,
23
osg::Vec3f translation, osg::Vec3f orientation,
24
std::string name, std::string type, bool active):
25
ObjectBase(attachedBody, translation, orientation, name, type, active),
26
myColor (new osg::Vec4(1.0f, 0.0f, 0.0f, 1.0f)),
27
cv (new ColorVisitor( *myColor )),
33
sprintf(file, "%s/StaticMeshes/sphere.3ds", SimulationUtils::getStageProjectPath().c_str());
35
LoadFile(file, false);
36
// this->mesh->SetModelRotation(osg::Vec3(90,90,0));//relOrientation.x(), relOrientation.y()+90, relOrientation.z()));
37
// this->mesh->SetModelTranslation(osg::Vec3(relTranslation.x() * scale.x(), relTranslation.y() * scale.y(), relTranslation.z() * scale.z()));
39
this->myBody->AddChild(this);
41
dtCore::Transform offset(relTranslation.x(), relTranslation.y(), relTranslation.z(), relOrientation.x()+180, relOrientation.y(), relOrientation.z());
42
SetTransform( offset, dtCore::Transformable::REL_CS );
45
SetScale(osg::Vec3(ledSize, ledSize, ledSize));
47
// ... and then, it is ready to place it in the scene
48
//this->addToScene(gamemanager->GetScene(), osgGroup);
50
GetOSGNode()->traverse(*cv);
54
void Led::setColor(osg::Vec4 color) {
55
cv = new ColorVisitor(color);
56
GetOSGNode()->traverse(*cv);