I downloaded irrlicht 1.7 on a windows box and compiled it using visual studio 2008, i ran the exmples and everything is working fine. However, i want to control the camera object with my own key event listener.
So i set up a normal camera (assuming that scmgr is my scene manager object) and in the main loop i'm rotating the camera on the x axis if user presses the up key. However, the camera seems not to rotate as the view is still the same. Debugging the application shows that the rotation member of the camera is increasing but with no effect in the scene. Can someone shed some light on this matter, your help is appreciated.
Here's the code snippet (omitting some blocks for brevity):
camera = scmgr->AddCameraSceneNode();
camera->setPosition( 0, 320, 0 );
camera->setTarget( 0, 0, 0 );
...
main loop:
while( device->run() )
{
...
if( myreceiver.UpKeyDown() )
{
camera->setRotation( camera->getRotation().X + 1, camera->getRotation().Y, camera->getRotation().Z );
}
...
}
Camera problem in irrlicht 1.7
To elaborate my problem further, i want to rotate the camera on the axis that is pointing toward a given target, so if the camera is a top view cam and you're seeing 4 quadrants on the screen
1 | 2
------
3 | 4
i want to make a 180 degree rotation in a way that the view will be
4 | 3
------
2 | 1
One of the ways i know mathematically is to apply a rotational transform on the Up vector of the camera. But doing that, is also not yielding any results.
1 | 2
------
3 | 4
i want to make a 180 degree rotation in a way that the view will be
4 | 3
------
2 | 1
One of the ways i know mathematically is to apply a rotational transform on the Up vector of the camera. But doing that, is also not yielding any results.
As hybrid mentioned - you can bind target and rotation together. Use yourCamera->bindTargetAndRotation(true) to do that.
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
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm