how to change camera matrix

classic Classic list List threaded Threaded
3 messages Options
S.W S.W
Reply | Threaded
Open this post in threaded view
|

how to change camera matrix

hi everyone,i want to track the movements of my aircraft to keep it always in the center of the viewport. so i think change the camera matrix might help. However, viewer->getCamera()->asMatrixTransform() rertuns NULL, i checked the source file and found code as follows: virtual MatrixTansform* asMatrixTransform(){return 0;}  no wondering the result is NULL. and i've run out of idea. hope you can help me.
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: how to change camera matrix

S.W.,

You can set the camera's view matrix with osg::Camera::setViewMatrix() or setViewMatrixAsLookAt().

Good luck!
Glenn Waldron / Pelican Mapping
S.W S.W
Reply | Threaded
Open this post in threaded view
|

Re: how to change camera matrix

sorry for my delayed reply,i just went to spring outing these days. it occurs to me that i can use setTetherNode to track my aircraft.but the function doesn't work successfully.it crashed before the sentence :setViewpoint(vp,duration_s) in the EarthManipulator.cpp file. 
here is my code: 
osg::ref_ptr<osg::Node> model = osgDB::readNodeFile("glider.osg"); 
osg::ref_ptr<osgEarth::Util::ObjectLocatorNode> loc = new ......; 
loc->getLocator->setPosition(osg::vec3d(lon,la,alt)); 
loc->addChild(model.get()); 
EM->setTetherNode(loc.get(),3); 

i just don't know why.


------------------ Original ------------------
From: "gwaldron [via osgEarth]"<[hidden email]>;
Date: 2017年5月19日(星期五) 晚上10:08
To: "霍乱"<[hidden email]>;
Subject: Re: how to change camera matrix

S.W.,

You can set the camera's view matrix with osg::Camera::setViewMatrix() or setViewMatrixAsLookAt().

Good luck!
Glenn Waldron / Pelican Mapping



If you reply to this email, your message will be added to the discussion below:
http://forum.osgearth.org/how-to-change-camera-matrix-tp7590898p7590901.html
To unsubscribe from how to change camera matrix, click here.
NAML