My intention is to rotate an object in the scene according to the mouse movement; when moving verically the object would spin along the Z axis and horizontally along the Y axis.
scene::ISceneNode* pobj = 0;
gui::ICursorControl* pmousecursor;
core::position2d<s32> mousepos_orn;
core::position2d<s32> mousepos_new;
core::position2d<s32> delta;
int div = 100; //division
if ( pobj != 0 && event.EventType == irr::EMOUSE_INPUT_EVENT) {
mousepos_orn = mousepos_new;
mousepos_new = pmousecursor->getPosition();
delta = mousepos_new - mousepos_orn;
/* Mouse.Y = rotation along Z, Mouse.X = rotating along Y */
pobj -> setRotation(core::vector3df( 0, static_cast<f32>(delta.X)/div, static_cast<f32>(delta.Y)/div) );
}
The problem is at the "if...." criteria statement...how do I correct it?
I've tried to find the manual and forum for several hours but still couldn't figure it out... any help?