Archived

This topic is now archived and is closed to further replies.

Mouse Over picking

This topic is 5377 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was wondering how you do mouse overs in your game. I had first tried rendering the scene into the select buffer (the same way that I do for mouse clicks) but this is way to slow to do for every mouse move. I was thinking about using the feedback buffer to get window coordinates of the objects that I want to do mouse over testing for, then handle it with bounding squares in 2D. Maybe I could render into the feedback buffer less frequently if the objects I want to mouse over arn''t moving... (ie, a grid square).. I would have to redo this everytime the camera moved... This would be used for things like highlighting a grid square when the user is supposed to select a destination square in a tile based game. Or for a menu to highlight options as the mouse passes over them. If there is a better way to do this, please let me know! Thanks Ickno

Share this post


Link to post
Share on other sites
You could project the mouse coordinates in 3d, and do a raytracing/raycasting check to see what it hits. I beleive this is VERY simple when working with a grid array (aka, height map type deal).

Share this post


Link to post
Share on other sites
I havent tried to do anything quite like that yet but you might get away with using the select buffer except when in selection mode only render the things that you can potentially click on. It should speed things up quite a bit but you''ll get side effects. Like if you check if you can click on an object that is behinds something you would still be able to click on it because you didn''t render all polys on the select buffer... but its just an idea...

Share this post


Link to post
Share on other sites
I suppose I could use model culling to limit the number of objects rendered when I am in select mode. That would speed it up, like you said.

I will also look into ray casting to solve this problem.

Thanks you two for the input.

Ickno

Share this post


Link to post
Share on other sites