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 

Overriding the mouse pan up/down


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
adrianj
Newbie


Joined: 19 Jan 2018
Posts: 14

PostPosted: Tue Feb 27, 2018 10:28 pm    Post subject:
Overriding the mouse pan up/down
Reply with quote

Hi,

When I pan left and right with my mouse the scene moves left and right. However, when I try to pan up and down the scene zooms in and out. How can I change this so that using the mouse in an up/down direction causes a pan in the up/down direction also?

Thank you!

Cheers,
Adrian
Back to top
View user's profile Send private message
Alberto Luaces
Guest





PostPosted: Wed Feb 28, 2018 7:59 am    Post subject:
Overriding the mouse pan up/down
Reply with quote

"Adrian Jelffs" writes:

Quote:
Hi,

When I pan left and right with my mouse the scene moves left and
right. However, when I try to pan up and down the scene zooms in and
out. How can I change this so that the using the mouse to in an
up/down direction causes a pan in the up/down direction?

Hi Adrian, it all comes down to inherit from your keyboard/mouse
controller (Graphics Adapter, GA in OSG) and overwrite the parts you
want to change.

In your case, your GA is likely inheriting from OrbitManipulator, see

src/osgGA/OrbitManipulator::handleMouseWheel

Please have also a look to the osghangglide example, which has another
custom manipulator use case.

--
Alberto



------------------
Post generated by Mail2Forum
Back to top
adrianj
Newbie


Joined: 19 Jan 2018
Posts: 14

PostPosted: Fri Mar 02, 2018 3:34 am    Post subject:
Reply with quote

Hi,

Thank you for the reply. I looked at those examples but it is not quite what I am looking for.

I am looking for something like this, but to Pan up when the mouse is dragged up:

_manip->getSettings()->bindMouse(osgEarth::Util::EarthManipulator::ACTION_PAN_UP, osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON);

My current settings are:

_manip->getSettings()->bindKey(osgEarth::Util::EarthManipulator::ACTION_ROTATE_LEFT, osgGA::GUIEventAdapter::KeySymbol::KEY_Left, osgGA::GUIEventAdapter::MODKEY_CTRL);
_manip->getSettings()->bindKey(osgEarth::Util::EarthManipulator::ACTION_ROTATE_RIGHT, osgGA::GUIEventAdapter::KeySymbol::KEY_Right, osgGA::GUIEventAdapter::MODKEY_CTRL);
_manip->getSettings()->bindKey(osgEarth::Util::EarthManipulator::ACTION_ROTATE_UP, osgGA::GUIEventAdapter::KeySymbol::KEY_Up, osgGA::GUIEventAdapter::MODKEY_CTRL);
_manip->getSettings()->bindKey(osgEarth::Util::EarthManipulator::ACTION_ROTATE_DOWN, osgGA::GUIEventAdapter::KeySymbol::KEY_Down, osgGA::GUIEventAdapter::MODKEY_CTRL);
_manip->getSettings()->bindKey(osgEarth::Util::EarthManipulator::ACTION_ZOOM_IN, osgGA::GUIEventAdapter::KeySymbol::KEY_Up, osgGA::GUIEventAdapter::MODKEY_CTRL | osgGA::GUIEventAdapter::MODKEY_SHIFT);
_manip->getSettings()->bindKey(osgEarth::Util::EarthManipulator::ACTION_ZOOM_OUT, osgGA::GUIEventAdapter::KeySymbol::KEY_Down, osgGA::GUIEventAdapter::MODKEY_CTRL | osgGA::GUIEventAdapter::MODKEY_SHIFT);
_manip->getSettings()->bindScroll(osgEarth::Util::EarthManipulator::ACTION_ZOOM_IN, osgGA::GUIEventAdapter::SCROLL_UP);
_manip->getSettings()->bindScroll(osgEarth::Util::EarthManipulator::ACTION_ZOOM_OUT, osgGA::GUIEventAdapter::SCROLL_DOWN);

But I have no bindMouse settings.

At the moment the "left click with drag up/down" causes a zoom in/out.

I want a "left click with drag up/down" to pan up/down.

Many thanks for your help!

Cheers,
Adrian
Back to top
View user's profile Send private message
adrianj
Newbie


Joined: 19 Jan 2018
Posts: 14

PostPosted: Fri Mar 16, 2018 2:16 am    Post subject:
Reply with quote

Hello,

I think I have figured out what is happening here. The problem is that I am using osgEarth and the mouse up and down movements are linked to the x and y of the earth, a bit like latitude and longitude. So if you look down at the earth from above then the panning works great. However if you zoom in to a panoramic view then the mouse is still hooked up to the x and y, so when you pan up and down it appears to be zooming in and out but really you are moving in the y direction and not the z direction.

I think the only way around this is to capture the mouse events myself and move the scene based on my own math.

If anybody has any ideas about how to capture the mouse events that would be great.

Cheers

Adrian
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 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 [customizing manipulator] problem wit... mp3butcher General 1 Tue Apr 24, 2018 3:19 pm View latest post
No new posts OSG & QtQuick(QML) & setMirro... karcios General 0 Wed Apr 11, 2018 12:45 pm View latest post
No new posts Mouse position to object space GeekOwl General 4 Thu Nov 23, 2017 11:45 am View latest post
No new posts Minor issue with GraphicsWindowWin32.... loopy General 0 Mon Jan 23, 2017 10:18 pm View latest post
No new posts Upon Clicking the mouse left button t... Rambabu General 6 Mon Dec 05, 2016 7:34 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