Hi,
I want to get the position of the center of my cone which was transformed
earlier. My point is I cannot get that position only by multiplying by matrices
of PositionAttitudeTransforms. Can someone help me?
Here is the code:
Code:
cone = new osg::Geode();
cs = new osg::Cone(osg::Vec3(0, 0, 0), std::tan(15.0 * M_PI / 180.0) *
2660.0, 2660.0);
shp = new osg::ShapeDrawable(cs);
rootNode -> addChild(mt);
mt -> addChild(rotation1);
rotation1 -> addChild(airplaneModel);
rotation1 -> addChild(rotation2);
rotation2 -> addChild(cameraModel);
rotation2 -> addChild(rotation3);
rotation3 -> addChild(cameraModel2);
rotation3 -> addChild(trans1);
trans1 -> addChild(rotation4);
rotation4 -> addChild(cone);
cone -> addDrawable(shp);
osgEarth::GeoPoint apGPoint(airplaneModel.latLong, airplaneModel.apLen,
airplaneModel.apLat, airplaneModel.apHeight, osgEarth::ALTMODE_ABSOLUTE);
osg::Matrix mat;
apGPoint.createLocalToWorld(mat);
airplaneModel.mt -> setMatrix(mat);
Other rotation and trans are PositionAttitudeTransform with set
attitude/position. Here is how I tried to compute the position:
Code:
osg::Vec3d endPoint = osg::Vec3d(0,0,0);
endPoint = endPoint *
osg::computeLocalToWorld(airplaneModel.rotation4 -> getParentalNodePaths()[0]) *
osg::computeLocalToWorld(airplaneModel.trans1 ->
getParentalNodePaths()[0]) *
osg::computeLocalToWorld(airplaneModel.rotation3 ->
getParentalNodePaths()[0]) *
osg::computeLocalToWorld(airplaneModel.rotation2 ->
getParentalNodePaths()[0]) *
osg::computeLocalToWorld(airplaneModel.rotation1 ->
getParentalNodePaths()[0]) *
airplaneModel.mt -> getMatrix();
Thank you!
Cheers,
Patryk[/code]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=62728#62728
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org