Custom camera control

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.
Post Reply
Clone256
Posts: 11
Joined: Thu Oct 13, 2005 9:20 pm

Custom camera control

Post by Clone256 »

I'm trying to use the code found at this link: http://www.irrforge.org/index.php/Custo ... ra_control

The problem is that if the mouse cursor isn't inside the window and sitting still when the program starts, the camera control doesn't work right. That seems to be the reason. It only rotates in 2 directions.

It happens in windowed and full screen.

Any information on this i'm missing?
Clone256
Posts: 11
Joined: Thu Oct 13, 2005 9:20 pm

Post by Clone256 »

After going over the code some more, I found the problem.

Code: Select all

//************************************************
//       MAIN LOOP                                                                                                                                         

	while(device->run() && driver){
    	if (device->isWindowActive())
    	{

    		driver->beginScene(true, true, SColor(255,0,0,0));               		 
            smgr->drawAll();

            //edit - The line below needed to be commented out for rotation to work
            //camMain->setTarget(camChild->getAbsolutePosition());            
     
            //Draw GRID
            driver->setTransform(video::ETS_WORLD, core::matrix4());
            video::SMaterial m;
            m.Lighting = false;
            driver->setMaterial(m);
            
            for(float i = -50; i <= 50; i += 10){
            driver->draw3DLine(vector3df(-50,0,i),vector3df(50,0,i)); 
            driver->draw3DLine(vector3df(i,0,-50),vector3df(i,0,50));
            }
             	
    		driver->endScene();
    		myEvents.manageEvents();
    	}
     }
I'd checked every other part of the program, but overlooked that one line at first.
Clone256
Posts: 11
Joined: Thu Oct 13, 2005 9:20 pm

Post by Clone256 »

Well, it isn't working today, which is weird. The program was working fine after that change yesterday. I haven't changed anything since then. I don't know what's wrong with this code.
Post Reply