Moving the camera
Posted: Sat Dec 30, 2006 8:12 pm
I am testing some camera movement and I could not get it to work so I just copied the code from the movement tutorial and that did not work either.
Here is the class
I used '-' instead indentation
camera is the camera node defined just above the class.
Any ideas?
Here is the class
Code: Select all
class CameraMovement : public IEventReceiver
{
public:
-------virtual bool OnEvent(SEvent event)
-------{
--------------if (camera != 0 && event.EventType == irr::EET_KEY_INPUT_EVENT&&
---------------------!event.KeyInput.PressedDown)
--------------{
---------------------switch(event.KeyInput.Key)
---------------------{
---------------------case KEY_KEY_W:
---------------------case KEY_KEY_S:
----------------------------{
-----------------------------------core::vector3df v = camera->getPosition();
-----------------------------------v.Y += event.KeyInput.Key == KEY_KEY_W ? 2.0f : -2.0f;
-----------------------------------camera->setPosition(v);
----------------------------}
----------------------------return true;
---------------------}
--------------}
--------------return false;
-------}
};camera is the camera node defined just above the class.
Any ideas?