How can i implement a "mouse ray" with MyGUI ?

compvis

29-06-2009 03:34:37

Hi,

With CEGUI, i can implement:

K_VALUE Core::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id)
{
//CEGUI's injection
.....................................
CEGUI::Point mousePos = CEGUI::MouseCursor::getSingleton().getPosition();
Ray mouseRay = mCamera->getCameraToViewportRay(mousePos.d_x/float(arg.state.width), mousePos.d_y/float(arg.state.height));


return true;

}


Now i switch to MyGUI library, How can i implement a mouse ray with MyGUI like the code fragment ?

Altren

29-06-2009 16:19:08

You can take current mouse position from OIS::MouseEvent.

my.name

29-06-2009 16:19:31


const MyGUI::IntPoint& point = MyGUI::InputManager::getInstance().getMousePosition();

Jdog

30-06-2009 02:07:52

Am I correct in assuming that 'top' and 'left' are the x and y feilds respectively?

I'm trying to get this raycast done from inside FrameStarted - I know this is more of an OIS question, but I'm having trouble getting hold of arg.state.width and arg.state.height here as I don't have the MouseEvent parameter. How can I get these inside FrameStarted?

compvis

30-06-2009 02:15:03

@my.name,Altren: thanks !

xypher

06-05-2010 03:07:19

arg.state.width and arg.state.height should be the same as your window dimensions, so you should use that instead.
I believe thats more for internal processing.