Implement setters for velocity notes in the model placement code.
Modified Files: simgear/scene/model/placement.cxx simgear/scene/model/placement.hxx
This commit is contained in:
@@ -9,9 +9,7 @@
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
#include <string.h> // for strcmp()
|
||||
|
||||
#include <plib/ul.h>
|
||||
#include <simgear/scene/util/SGSceneUserData.hxx>
|
||||
|
||||
#include "location.hxx"
|
||||
#include "placementtrans.hxx"
|
||||
@@ -49,7 +47,6 @@ SGModelPlacement::init( osg::Node * model )
|
||||
_position->addChild(model);
|
||||
}
|
||||
_selector->addChild(_position.get());
|
||||
// _selector->setNodeMask(_selector->getNodeMask() & ~SG_HOT_TRAVERSAL_BIT);
|
||||
_selector->setValue(0, 1);
|
||||
}
|
||||
|
||||
@@ -147,4 +144,24 @@ SGModelPlacement::setOrientation (const SGQuatd& orientation)
|
||||
orientation.getEulerDeg(_heading_deg, _pitch_deg, _roll_deg);
|
||||
}
|
||||
|
||||
void
|
||||
SGModelPlacement::setBodyLinearVelocity(const SGVec3d& linear)
|
||||
{
|
||||
SGSceneUserData* userData;
|
||||
userData = SGSceneUserData::getOrCreateSceneUserData(_position);
|
||||
SGSceneUserData::Velocity* vel = userData->getOrCreateVelocity();
|
||||
SGQuatd orientation = SGQuatd::fromAngleAxisDeg(180, SGVec3d(0, 1, 0));
|
||||
vel->linear = orientation.backTransform(linear);
|
||||
}
|
||||
|
||||
void
|
||||
SGModelPlacement::setBodyAngularVelocity(const SGVec3d& angular)
|
||||
{
|
||||
SGSceneUserData* userData;
|
||||
userData = SGSceneUserData::getOrCreateSceneUserData(_position);
|
||||
SGSceneUserData::Velocity* vel = userData->getOrCreateVelocity();
|
||||
SGQuatd orientation = SGQuatd::fromAngleAxisDeg(180, SGVec3d(0, 1, 0));
|
||||
vel->angular = orientation.backTransform(angular);
|
||||
}
|
||||
|
||||
// end of model.cxx
|
||||
|
||||
@@ -77,6 +77,9 @@ public:
|
||||
virtual void setOrientation (double roll_deg, double pitch_deg,
|
||||
double heading_deg);
|
||||
void setOrientation(const SGQuatd& orientation);
|
||||
|
||||
void setBodyLinearVelocity(const SGVec3d& velocity);
|
||||
void setBodyAngularVelocity(const SGVec3d& velocity);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user