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 

How to change camera's yaw and pitch, and move front, back and sideways according to that?


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


Joined: 01 Mar 2017
Posts: 24

PostPosted: Thu Jan 31, 2019 12:43 am    Post subject:
How to change camera's yaw and pitch, and move front, back and sideways according to that?
Reply with quote

I want to change the camera direction with the mouse, and position with the keyboard. I've found an example on how to change the position, but still couldn't find anything explaining how to change the direction (and not sure if the position will change correctly when the direction changes). All I find is "take a look at the manipulator source code, it will give inspiration" etc. But I just don't get how can I implement that from the source code I saw.

Considering this is such a trivial task, why is it virtually impossible to find a simple source code showing how it's done?

Thanks,
Rodrigo
Back to top
View user's profile Send private message
Trajce Nikolov NICK
Guest





PostPosted: Thu Jan 31, 2019 11:31 am    Post subject:
How to change camera's yaw and pitch, and move front, back and sideways according to that?
Reply with quote

Hi,


viewer.getCamera()->setViewMatrixAsLookAt




On Thu, Jan 31, 2019 at 10:01 AM Rodrigo Dias < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
I want to change the camera direction with the mouse, and position with the keyboard. I've found an example on how to change the position, but still couldn't find anything explaining how to change the direction (and not sure if the position will change correctly when the direction changes). All I find is "take a look at the manipulator source code, it will give inspiration" etc. But I just don't get how can I implement that from the source code I saw.

Considering this is such a trivial task, why is it virtually impossible to find a simple source code showing how it's done?

Thanks,
Rodrigo

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





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


--
trajce nikolov nick

------------------
Post generated by Mail2Forum
Back to top
Rodrigo
User


Joined: 01 Mar 2017
Posts: 24

PostPosted: Thu Jan 31, 2019 1:28 pm    Post subject:
Reply with quote

Dear Trajce,

do you have any idea how incomplete is your answer? There's no point in knowing the function if I don't know how to set its parameters correctly.

What everybody learning OSG need is "a simple source code showing how it's done", and this means a few lines of code, not less than a single line. Please.
Back to top
View user's profile Send private message
sbrkopac
Newbie


Joined: 14 Jun 2018
Posts: 19

PostPosted: Thu Jan 31, 2019 2:58 pm    Post subject:
Reply with quote

Hi Rodrigo,

The Camera::setViewMatrixLookAt function is equivalent to the gluLookAt. You can find more documentation on the inner workings here.

If you don't set a camera manipulator prior to viewer.run() and move the camera the results will be lost due to viewer.run() setting up its own manipulator and overriding your initial setup. You have a few options: assign the camera manipulator -> update the manipulator -> call home(1) to force an update. Don't call viewer.run() and implement the loop yourself (this will prevent a manipulator from getting set and allowing you to freely manually manipulate the camera). Implement your own manipulator and set it before you call viewer.run().

If you have a specific question regarding one of the manipulators, please ask.
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 [3rdparty] 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 AddSlave & removeSlave camera see... bclay General 2 Wed Apr 10, 2019 6:52 pm View latest post
No new posts FPS camera Ligvest General 0 Mon Apr 01, 2019 1:03 pm View latest post
No new posts First Person Camera disable inertial ... Ligvest General 3 Thu Mar 28, 2019 1:01 pm View latest post
No new posts Make an object linked to camera moove... GiacomoB General 0 Wed Mar 20, 2019 9:45 am View latest post
No new posts setViewMatrixAsLookAt not working to ... Rodrigo General 4 Tue Jan 08, 2019 2:48 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