mouse over object

Started by
3 comments, last by imortales 17 years, 1 month ago
Hi! I am using my mouse to move the object around the space (glTranslate). I need the mouse pointer to be on the same spot of the object when I move it around. The problem is that the mouse pointer moves faster than the object. I've scaled down the mouse movement and the results are better, however I would like to ensure that the mouse pointer is always on the exactly same spot of the object. What calculations are needed?
Advertisement
Your mouse movements are in screen space.

Your object's movements are done in world (camera) space.
So how do I convert screen space to world space?
This is the technique I use for mouse selection:

http://nehe.gamedev.net/data/articles/article.asp?article=13

Project your object coordinates into screen space using gluUnProject, project screen to object space using gluProject.
That's it. Thanks!

This topic is closed to new replies.

Advertisement