Hi,
Here's what I've done so far towards this end (height of model vs reality)...
Code:
if(boat.valid())
{
boat->setNodeMask( scene->getOceanScene()->getNormalSceneMask() |
scene->getOceanScene()->getReflectedSceneMask() |
scene->getOceanScene()->getRefractedSceneMask() );
osg::ref_ptr<osg::PositionAttitudeTransform> boatTransform = new
osg::PositionAttitudeTransform;
//Name that NODE!
//Hmmm... there seems to be some discussion on wether to use the node
of the
// transform or the node of the boat! (which... I wonder?...)
boatTransform->setName("BOAT");
boatTransform->addChild(boat.get());
//This I did for my collada models... and it seems to help... but still
needs "tweaking"
//Like... "You've... got (to bail)" (sorry... old movie)
const osg::BoundingSphere& bs = boat->getBound();
boatTransform->setPivotPoint(bs.center());
//I want my boat pointing in a direction I can manipulate easily... "y"
osg::Vec3 boatPosit(0,100,1.5);
boatTransform->setPosition( boatPosit );
boatTransform->setAttitude(osg::Quat( osg::DegreesToRadians(90.0) ,
osg::Vec3(0,0,1) ));
//I hope this is the right thing to do...
boatTransform->setUpdateCallback( new
BoatPositionCallback(scene->getOceanScene()) );
scene->getOceanScene()->addChild(boatTransform.get());
}
[
The above stuff at least landed my collada boat in the water... and then...
"tweaking" for the appropriate waterline.
Oh... I left the "hmmm... " note in there because I started using a
PositionAttitudeTransform in my call back for a camera lately... and there has
been a discussion on using the transform or its child when adding the node...
(sigh)
Thank you!
Please comment if you feel any need... because I need a disturbance in the
force...
Cheers,
tim
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=37669#37669
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org