Hello World,
I am trying to create a visible vector that moves around a set space with one
point stationary. I have polling data which can be used for the polling
position of the dynamic point.
Here is how I set up my vector. I do not know how to create the vector visible
and then start to move the dynamic end point with relation to the stationary
end point.
The Vector just has to be a visible line that can be colored to make it stand
out from the background.
[code]
class orientVector : public osg::NodeCallback{
public:
orientVector::orientVector():
pos()
{};
orientCoords pos;
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
pos.coordsCalc();
osg::PositionAttitudeTransform* moveVector =
dynamic_cast <osg::PositionAttitudeTransform*>(node);
//std::cout<<"X - Value: "<< pos.itsX <<"Y - Value: "<<
pos.itsY << "Z - Value: " << pos.itsZ << std::endl;
moveVector->setPosition( osg::Vec3( pos.itsX, pos.itsY,
pos.itsZ));
traverse(node, nv);
}
};
/***** DRAW THE FIRST VECTORS *****/
osg::Vec3Array* lineVisible1 = new osg::Vec3Array;
osg::Geode* lineVertex1 = new osg::Geode;
osg::Geometry* lineGeometry1 = new osg::Geometry;
lineVisible1->push_back( osg::Vec3 (511.33, 0, 767));
lineVisible1->push_back( osg::Vec3 (767, 767, 767));
lineGeometry1->setVertexArray( lineVisible1 );
lineVertex1->addDrawable(lineGeometry1);
//**** ORIENT THE VECTOR WITH IR DATA *******/
osg::PositionAttitudeTransform* vectorOrient = new
osg::PositionAttitudeTransform;
vectorOrient->addChild(lineVertex1);
vectorOrient->setUpdateCallback(new orientVector());
[/code]
I later on I will be setting up another vector at another static position so
that in the end there will be two vectors who "point" at one object as the
object moves through space.
...
I really appreciate all the help I can get! :D
Cheers,
Richard
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=34354#34354
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org