OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Change the position and rotation angle of the camera


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General [forum]
View previous topic :: View next topic  
Author Message
Becky
User


Joined: 27 Mar 2014
Posts: 23

PostPosted: Tue Apr 01, 2014 9:37 am    Post subject:
Change the position and rotation angle of the camera
Reply with quote

Hi,

I draw a box using addDrawable. Then I want to change the position and rotation angle of the camera by:

viewer->getCamera()->setViewMatrix(cameraTranslationMatrix);

But actually it makes no change to the camera. The cube is still in the center of the screen after run the scene.

I also tried to update the frame by using the following code, but also failed:

while(!viewer->done())
{
viewer->getCamera()->setViewMatrixAsLookAt(eye,center,up);
viewer->frame();
}


Would anyone tell me what could I do to move the camera?

Thank you!

Cheers,
Becky
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11019

PostPosted: Thu Apr 17, 2014 8:26 am    Post subject:
Change the position and rotation angle of the camera
Reply with quote

Hi Becky,

If you viewer has a CameraManipulator attached to it he manipulator
will keep overriding the matrix you set on each frame, simply don't
assigned a CameraManipulator and you should be fine.

Robert.

On 1 April 2014 10:37, ying song <> wrote:
Quote:
Hi,

I draw a box using addDrawable. Then I want to change the position and rotation angle of the camera by:

viewer->getCamera()->setViewMatrix(cameraTranslationMatrix);

But actually it makes no change to the camera. The cube is still in the center of the screen after run the scene.

I also tried to update the frame by using the following code, but also failed:

while(!viewer->done())
{
viewer->getCamera()->setViewMatrixAsLookAt(eye,center,up);
viewer->frame();
}


Would anyone tell me what could I do to move the camera?

Thank you!

Cheers,
Becky

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=58769#58769








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General [forum] All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts How to change "field of view&quo... arfaa General 0 Mon Aug 07, 2017 1:37 pm View latest post
No new posts change default coordinate system unit vinothrajendran4 General 1 Wed May 31, 2017 5:03 am View latest post
No new posts what should I dirty when I change Col... Trajce Nikolov NICK General 2 Wed May 03, 2017 6:47 pm View latest post
No new posts Fix FBX rotation matrix computation Farshid Lashkari Submission 1 Tue Apr 11, 2017 11:21 pm View latest post
No new posts How to get the camera's roll pitch an... xdfanfan General 1 Sat Apr 01, 2017 8:43 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP