Hi all,
I need some help with using Spheres and intersecting them correctly with
my terrain, which is NOT at (0,0,0) in geodetic space. I've tried
everything I can find and I still can not orient my sphere segment
correctly! It's driving me crazy!! Would someone please help me? :-[
Here's some of the code I've used so far:
//v3 = osgViewer_ComputeTerrainIntersection( loadedModel, -2174905,
-4899561);
//osg::ref_ptr<osgSim::SphereSegment>
// sphere4 = new osgSim::SphereSegment(
// v3,
// 100.f, // radius
// v3,
// osg::DegreesToRadians(360.0f),// azRange
// osg::DegreesToRadians(360.0f),// elevRange
// 40); // density
// sphere4->setAllColors( osg::Vec4(1.0f, 1.0f, 1.0f, 0.5f) );
// sphere4->setSideColor( osg::Vec4(0.0f, 1.0f, 1.0f, 0.1f) );
//sphereXform->addChild(sphere.get());
//osg::Quat orientation = defaultOrientation;
//osg::Matrix m;
//osg::ref_ptr<osg::Node> sphereNode =
sphere->computeIntersectionSubgraph( m, loadedModel);
//orientation.set(m);
//sphereXform->setAttitude( orientation );
//sphereXform->addChild(sphere.get());
**************************************************************************************
osg::PositionAttitudeTransform *sphereXform = new
osg::PositionAttitudeTransform();
root->addChild(sphereXform);
v3 = osgViewer_ComputeTerrainIntersection( loadedModel, -2175161,
-4898049);
osg::ref_ptr<osgSim::SphereSegment>
sphere = new osgSim::SphereSegment(
osg::Vec3(-2174905, -4899561,
3445526), // center
500.f, // radius
osg::Vec3( 0 , 0, 0 ),
osg::DegreesToRadians(360.0f),// azRange
osg::DegreesToRadians(35.0f),// elevRange
40); // density
sphere->setAllColors( osg::Vec4(1.0f, 1.0f, 1.0f, 0.5f) );
sphere->setSideColor( osg::Vec4(0.0f, 1.0f, 1.0f, 0.1f) );
//
//// osg::DegreesToRadians( roll ),
osg::Vec3(0,1,0),
//// osg::DegreesToRadians( pitch ),
osg::Vec3(1,0,0),
//// osg::DegreesToRadians( heading
),osg::Vec3(0,0,1)));
//
//
//osg::Quat orientation = defaultOrientation;
// orientation = osg::Quat( osg::DegreesToRadians(-45.0),
osg::Vec3(-2174905, -4899561, 3445526),
// osg::DegreesToRadians(-225.0),
osg::Vec3(-2174905, -4899561, 3445526),
// osg::DegreesToRadians(-30.0),
osg::Vec3(-2174905, -4899561, 3445526)
// );
//sphereXform->setAttitude( orientation );
***********************************************************************
I can not get any of this to work and I have no idea what I'm missing.
But everytime I attempt to "orient" my sphere in my terrain it is just
moved around on the terrain and not rolled, pitched, or yawed in the
direction I desire.
Any suggestions? :'(
--
Sincerely, Allen
Gene Allen Saucier, Jr
Senior Software Engineer
CAS, Inc
100 Quality Circle
Huntsville, AL 35806
or
PO Box 11190
Huntsville, AL 35814
(256) 922-6453 (w)
"As for I and my house, we shall follow the Lord" Joshua 25:14
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/