hey,
i've searched the forum for several hours now and didnt find anything that helps me ...
i want to do picking ... ok found sth using rays but that needs the mouse coordinates but i cant find anything on how to get them ...
and where can i get the screen resolution?
mouse screencoordinates + resolution
-
- Gnoblar
- Posts: 12
- Joined: Tue Dec 21, 2004 3:31 am
- Location: UK
http://www.ogre3d.org/docs/api/html/str ... State.html
theres the mouse stuff you need
don't know about the screen resolution but it should be in the API reference somewhere too.
hope that helps
EDIT:
found it!
looks like you need RenderTarget->getWidth et al. see this URL for more info
http://www.ogre3d.org/docs/api/html/cla ... arget.html
theres the mouse stuff you need
don't know about the screen resolution but it should be in the API reference somewhere too.
hope that helps

EDIT:
found it!

looks like you need RenderTarget->getWidth et al. see this URL for more info
http://www.ogre3d.org/docs/api/html/cla ... arget.html
-
- Gnoblar
- Posts: 9
- Joined: Wed Dec 22, 2004 4:14 am
-
- Gnoblar
- Posts: 12
- Joined: Tue Dec 21, 2004 3:31 am
- Location: UK
-
- Gnoblar
- Posts: 1
- Joined: Fri Dec 31, 2004 6:33 am
hey I'm having a similar problem. I checked the api reference but I can't seem to figure it out. I need to get the absolute position of the mouse cursor. This is the code i have to determine where on the terrain the mouse was clicked:
The cursor position returned is some very large number. I also tried this code but got the same results:
edit:: also, is there any way to prevent the standard OS cursor from being disabled in ogre? Or do i have to track the cursor and display some sort of bitmap image as a custom cursor?
thanks
Code: Select all
if(mInputDevice->getMouseButton(1) && robots && timeUntilNextToggle <= 0)
{
timeUntilNextToggle = 0.5;
Ray updateRay;
Ray r;
r.setOrigin(mCamera->getPosition());
RaySceneQuery& raySceneQuery = *(mSceneMgr->createRayQuery(r,0));
updateRay.setOrigin(mCamera->getPosition());
updateRay = mCamera->getCameraToViewportRay(mInputDevice->getMouseAbsX(), mInputDevice->getMouseAbsY());
raySceneQuery.setRay(updateRay);
RaySceneQueryResult& qryResult = raySceneQuery.execute();
RaySceneQueryResult::iterator i = qryResult.begin();
if (i != qryResult.end() && i->worldFragment)
{
std::cout << i->worldFragment->singleIntersection.x << " "
<< i->worldFragment->singleIntersection.z << "\n";
Vector2 v;
v.x = i->worldFragment->singleIntersection.x;
v.y = i->worldFragment->singleIntersection.z;
rbot->walk_to(v);
}
}
Code: Select all
Ogre::MouseState ms;
mInputDevice->getMouseState(ms);
std::cout << "\n" << ms.Xrel << " " << mInputDevice->getMouseAbsY();
thanks
-
- Gnoblar
- Posts: 9
- Joined: Wed Dec 22, 2004 4:14 am
Hey,
you can get the mouse position on the screen with a GuiContainer
You can change the mouse cursor by creating your own overlay for it ...
happy new year
Zoldan
you can get the mouse position on the screen with a GuiContainer
Code: Select all
GuiContainer* cursor = OverlayManager::getSingleton().getCursorGui();
happy new year
Zoldan