HI Patryk, You code snippets is a bit confusing - it's way overcomplicated for what it should be. My best guess is that you've somehow confused how the osg::computeLocalToMatrix(NodePath) should be used. Simply give it the NodePath from root to specific node of interest, computeLocalToMatrix will do all the matrix accumulation for you, there isn't any need to individually multiple the paths of every node in the parental chain as you seem to be trying to do.
Robert. On 19 February 2015 at 09:36, Patryk Piotr <pwaso...@mion.elka.pw.edu.pl> wrote: > 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 > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org