I've a problem with my mouse receiver.
I want to create a camera who can turn around 1 point and zoom in and out at that point. Fist I used this code for my event receiver:
Code: Select all
if (event.EventType == irr::EET_MOUSE_INPUT_EVENT)
{
switch(event.MouseInput.Event)
{
case EMIE_MOUSE_MOVED:
{
MouseSpeedX = (OldX-event.MouseInput.X);
MouseSpeedY = (OldY-event.MouseInput.Y);
OldX = event.MouseInput.X;
OldY = event.MouseInput.Y;
MouseMoved = true;
}
}
}
A part of my event receiver:
Code: Select all
if (event.EventType == irr::EET_MOUSE_INPUT_EVENT)
{
switch(event.MouseInput.Event)
{
case EMIE_MOUSE_MOVED:
{
MouseSpeedX = (512-event.MouseInput.X);
MouseSpeedY = (384-event.MouseInput.Y);
device->getCursorControl()->setPosition(512,384);
MouseMoved = true;
}
}
}
This is the MouseMoving part of my main loop:
Code: Select all
if(MouseMoved)
{
cameraAngle+=MouseSpeedX * 0.1;
v = camera->getPosition();
camera->setPosition(core::vector3df(cos(cameraAngle)*CameraZoom,v.Y - MouseSpeedY,sin(cameraAngle)*CameraZoom));
MouseMoved = false;
}
So I don't know what to change... I would be very happy if someone could help me out with this problem