MouseWheel move Camera
Posted: Tue Nov 17, 2009 10:01 am
How can I control camera movement (forward-backward) by mouse wheel rotation?
Official forum of the Irrlicht Engine
https://irrlicht.sourceforge.io/forum/
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.hMorganolla wrote:So, Irrlicht is not fully open source engine? I interesting how realise camera rotation member-functions in this class...
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!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.
Work smart, not hard.Morganolla wrote: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!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.
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);
}
}
}
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.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...:)