so everytime the keyboardhandler is called, the camera matrix is updated
through this function ?

not really, this apply method is called on update traversal of the
scenegraph. the keyboard handler is updating your objects ....

-Nick


On Thu, May 20, 2010 at 9:49 PM, Trajce (Nick) Nikolov <
[email protected]> wrote:

> apply is called automatically by the internals of osg, you dont have to
> call it. In your camera apply you have to set the view matrix of the camera.
> like
>
> virtual void apply(osg::Node* node, osg::NodeVisitor* nv)
>  {
>    osg::Camera* camera = dynamic_cast<osg::Camera*>(node);
>    osg::Vec3 eye;
>    osg::Vec3 center;
>    osg::Vec3 up;
>    camera->getViewMatrixAsLookAt(eye,center,up);
>
>    camera->setViewMatrixAsLookAt(eye,myObjectPosition,up);
>
>    traverse(node);
>
> }
>
> so your camera update callback need to know about your object position. and
> you only set the update callback and thats it :)
>
>
> -Nick
>
>
>
> On Thu, May 20, 2010 at 8:37 PM, Sanat Talmaki <[email protected]>wrote:
>
>> I tried to implement the apply function as below, most of the examples
>> just had this basic implementation:
>>
>> void CameraFollowMyNodeCallback::apply(osg::Node* node, osg::NodeVisitor*
>> nv)
>> {
>>  osg::Camera* camera = dynamic_cast<osg::Camera*>(node);
>>   traverse(camera, nv);
>>   // Here you set from the snippet bellow
>> }
>>
>> so everytime the keyboardhandler is called, the camera matrix is updated
>> through this function ?
>>
>> Thanks
>>
>> ------------------
>> Read this topic online here:
>> http://forum.openscenegraph.org/viewtopic.php?p=28089#28089
>>
>>
>>
>>
>>
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to