MouseWheel move Camera

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Morganolla
Posts: 44
Joined: Tue Nov 17, 2009 9:56 am
Location: Rus

MouseWheel move Camera

Post by Morganolla »

How can I control camera movement (forward-backward) by mouse wheel rotation?
Reiko
Posts: 105
Joined: Sun Aug 16, 2009 7:06 am
Location: Australia

Post by Reiko »

Try see if something from this can help

http://irrlicht.sourceforge.net/phpBB2/ ... 711#202711
Morganolla
Posts: 44
Joined: Tue Nov 17, 2009 9:56 am
Location: Rus

Post by Morganolla »

I can not find ICameraSceneNode.cpp in source directory Irrlicht 1.6 ... Why?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

There's only ICameraSceneNode.h. It's an interface which needs no or not much implementation. Hence header only.
Morganolla
Posts: 44
Joined: Tue Nov 17, 2009 9:56 am
Location: Rus

Post by Morganolla »

So, Irrlicht is not fully open source engine? I interesting how realise camera rotation member-functions in this class... :(
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Post by ent1ty »

So, why don't you look in ICameraSceneNode.h like hybrid told you?
Morganolla
Posts: 44
Joined: Tue Nov 17, 2009 9:56 am
Location: Rus

Post by Morganolla »

Sorry, I look at it. But I want to see realisation (code) "ICameraSceneNode::OnEvent" for example... and etc. Is it possible? I want to built my own control for camera. But manual seems to me very poor...
Last edited by Morganolla on Tue Nov 17, 2009 7:43 pm, edited 1 time in total.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The manual only deals with the user side of the code. The engine code is not covered by the manual. But you can look at CCameraSceneNode.cpp to see one implementation of that interface.
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Post by Seven »

Morganolla wrote:So, Irrlicht is not fully open source engine? I interesting how realise camera rotation member-functions in this class... :(
what they are telling you is that the header file you are looking at only has the definition for the interface. That interface is used as the template for all of the cameras, so you will have to look at the CCameraSceneNode.cpp file to see one method of how the interface was used to create a certain type of camera. There are many different cameras, but they all derive from the interface that you see in ICameraSceneNode.h
Morganolla
Posts: 44
Joined: Tue Nov 17, 2009 9:56 am
Location: Rus

Post by Morganolla »

By the way... Excuse, can I see anywhere a complete description (code) member "ICameraSceneNode::OnEvent"... Or it does not exist... all over the world. :) Or it is closed information?
I want to understand it for my future investigation this engine...:)
Last edited by Morganolla on Tue Nov 17, 2009 7:43 pm, edited 1 time in total.
Reiko
Posts: 105
Joined: Sun Aug 16, 2009 7:06 am
Location: Australia

Post by Reiko »

I think you're going about this the hard way mate. Just check out the example I linked you to, and change it or take from it to fit your needs.
Morganolla
Posts: 44
Joined: Tue Nov 17, 2009 9:56 am
Location: Rus

Post by Morganolla »

Reiko wrote:I think you're going about this the hard way mate. Just check out the example I linked you to, and change it or take from it to fit your needs.
Thanks, friend, but Russian engineers very much like to get to the bottom of the truth...:)And they are not afraid of a hard work!
Brkopac
Posts: 88
Joined: Fri Sep 19, 2008 2:36 am

Post by Brkopac »

Morganolla wrote:
Reiko wrote:I think you're going about this the hard way mate. Just check out the example I linked you to, and change it or take from it to fit your needs.
Thanks, friend, but Russian engineers very much like to get to the bottom of the truth...:)And they are not afraid of a hard work!
Work smart, not hard.
Image - The glory days.
MarvLeonidasX
Posts: 15
Joined: Fri Oct 09, 2009 2:54 pm

Post by MarvLeonidasX »

Here is a snippet:

Code: Select all

virtual bool OnEvent(const SEvent& event)
        {
            cam_pos = camera->getPosition();

            if(event.EventType == EET_MOUSE_INPUT_EVENT)
            {

                // Camera Zoom
                if(eventp.Event == EMIE_MOUSE_WHEEL)
                {
                    if(cam_pos.getLength() > 100 || cam_pos.getLength() < 600)
                    {
                        cam_pos = cam_pos.setLength( cam_pos.getLength() - (eventp.Wheel * 25) );
                        if(cam_pos.getLength() < 100)
                        {
                            cam_pos.setLength(100);
                        }
                        if(cam_pos.getLength() > 600)
                        {
                            cam_pos.setLength(600);
                        }

                    }
                    camera->setPosition(cam_pos);
                }
            }
        }
"Mission failed: Your team was wiped out."
CuteAlien
Admin
Posts: 9716
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Morganolla wrote:By the way... Excuse, can I see anywhere a complete description (code) member "ICameraSceneNode::OnEvent"... Or it does not exist... all over the world. :) Or it is closed information?
I want to understand it for my future investigation this engine...:)
Nothing is closed. Irrlicht is completely OpenSource. But the headers contain interface classes (starting always with I) which means they usually don't have an implementation but describe how the interface of the implementation classes has to look like. There are also CCameraSceneNode classes which are an implementation of such an interface. Those are in the source folder. And when it comes to scrolling a camera with mouse I usually implement that myself.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply