-
Hi, I bought the OpenSceneGraph 3.0 book which is very helpful; but nowhere does it tell me how to move to the camera to a specific coordinate or how to rotate it. What is the best way this can be done? I have my own custom Camera Manipulator, does it need to be done in there? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
osg::Camera has a series of setVIewMatrix*() methods that allow it's view matrix to be set in various ways, you can call these in a camera manipuator or just directly in your main frame loop. You only need to use a camera manipulator if you want to add event handling to control the camera. The various osgGA camera manipulators will be a helpful guide. As a general note, the OpenSceneGraph like OpenGL is now in maintenance mode, intended primarily for existing users. For new application development I'd recommend look at the OSG's successor VullkanSceneGraph. |
Beta Was this translation helpful? Give feedback.
-
Could you explain to me why the following code doesn't work then?
My debugger seems to say the values I set got overridden the next frame. |
Beta Was this translation helpful? Give feedback.
-
There's a lot of things that can be controlling the camera. In a Viewer,
the Viewer's own manipulator often controls the camera.
We'd need to know a lot more about your program to answer.
Is this a simple demo you could post in its entirety?
…On Tue, Oct 24, 2023 at 2:05 PM Brigham Keys, Esq. ***@***.***> wrote:
Could you explain to me why the following code doesn't work then?
float x = 100;
float y = 1000;
float z = 1000;
osg::Matrixd mat;
mat.makeTranslate(osg::Vec3(x, y, z));
viewer.getCamera()->setViewMatrix(mat);
Is something overriding the values I am specifying?
—
Reply to this email directly, view it on GitHub
<#1263 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPFE3GSTRBBNRZ35IEBK4LYBANSLAVCNFSM6AAAAAA6OBULU6VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TGNZUGE2DM>
.
You are receiving this because you are subscribed to this thread.Message
ID: <openscenegraph/OpenSceneGraph/repo-discussions/1263/comments/7374146@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
So I learned the values were being overridden because of my use of a CameraManipulator; I solved it by not using a manipulator then I was able to set the values to whatever I wanted. I am using SDL2 for event handling so not using a manipulator poses little issue. |
Beta Was this translation helpful? Give feedback.
So I learned the values were being overridden because of my use of a CameraManipulator; I solved it by not using a manipulator then I was able to set the values to whatever I wanted. I am using SDL2 for event handling so not using a manipulator poses little issue.