Page 1 of 2

MouseWheel move Camera

Posted: Tue Nov 17, 2009 10:01 am
by Morganolla
How can I control camera movement (forward-backward) by mouse wheel rotation?

Posted: Tue Nov 17, 2009 10:30 am
by Reiko
Try see if something from this can help

http://irrlicht.sourceforge.net/phpBB2/ ... 711#202711

Posted: Tue Nov 17, 2009 12:41 pm
by Morganolla
I can not find ICameraSceneNode.cpp in source directory Irrlicht 1.6 ... Why?

Posted: Tue Nov 17, 2009 12:58 pm
by hybrid
There's only ICameraSceneNode.h. It's an interface which needs no or not much implementation. Hence header only.

Posted: Tue Nov 17, 2009 1:29 pm
by Morganolla
So, Irrlicht is not fully open source engine? I interesting how realise camera rotation member-functions in this class... :(

Posted: Tue Nov 17, 2009 1:32 pm
by ent1ty
So, why don't you look in ICameraSceneNode.h like hybrid told you?

Posted: Tue Nov 17, 2009 1:46 pm
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...

Posted: Tue Nov 17, 2009 2:27 pm
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.

Posted: Tue Nov 17, 2009 3:32 pm
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

Posted: Tue Nov 17, 2009 7:19 pm
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...:)

Posted: Tue Nov 17, 2009 7:32 pm
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.

Posted: Tue Nov 17, 2009 7:51 pm
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!

Posted: Tue Nov 17, 2009 8:04 pm
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.

Posted: Tue Nov 17, 2009 9:00 pm
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);
                }
            }
        }

Posted: Wed Nov 18, 2009 2:49 am
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.