|
发表于 2011-12-9 12:29:53
|
显示全部楼层
本帖最后由 fenma3422 于 2011-12-9 13:22 编辑
osg::Matrix ma;
ma = useEH.getNodeMatrix();
tankXPosition = ma.getTrans().x();
tankYPosition = ma.getTrans().y();
tankSelfSegment->set(osg::Vec3(tankXPosition,tankYPosition,999) ,osg::Vec3(tankXPosition,tankYPosition,-999));
findTankElevationVisitor.addLineSegment(tankSelfSegment);
node->accept(findTankElevationVisitor);
tankElevationLocatorHits = findTankElevationVisitor.getHitList(tankSelfSegment);
heightTestResults = tankElevationLocatorHits.front();
terrainHeight = heightTestResults.getWorldIntersectPoint();
ma.getTrans().z() = terrainHeight.z();
我大致看了下你的程序,且不说求交是否正确,此句是不可能改变你的预想中的mat的,因为你这里的mat是一个局部变量,你改完了,他就释放了,无法作用到坦克或你的视点上
而且ma.getTrans().z() = terrainHeight.z();[/quote]
根本无法改变mat的内容 |
|