Converting window X/Y coordinates to ingame coordinates

Started by
4 comments, last by Aardvajk 17 years, 5 months ago
I'm reading a bunch of stuff, and I'm pretty confused, my question is: How do I convert window X and Y coordinates ( (0,0) through (800x600)) to "Diablo II" ingame world coordinates ( (0,0) through (20000,20000) or so) -- I know the world X and Y underneath me; here's a picture to visualize it: http://img525.imageshack.us/img525/4051/d2coordsclickap7.jpg I'm really sorry if this is uninformative, or is very common; I don't even know how to articulate my question very well. Thanks for giving me the time of day, though, and I appreciate any responses :)
Advertisement
I can't help you with Diablo II as I don't know anything about it, but you should look into projections (look on the internet there are quite a few resources on that)
What information would you require?

Thanks for the reply, I'll definitely look up projections :)
This process is usually known as 'picking' in 3D -- you need to project your screen coordinates into world coordinates, taking into account your current "scroll" inside the world (if the world coordinate system is larger than the screen coordinates).

Searching for isometric picking might help.
I was wondering, is Diablo II real 3D or 2d?
I think Diablo II is isometric. The same technique should work though if you have the objects you're picking from in genuine 3D coordinates; an isometric view still has a projection matrix you can use for picking.

If you don't have the heightmap for the ground then you can only approximate based on the X and Y axes on the ground and the screen.
Alright, thanks guys; I've got something to research now.

However, it's hard for me to find resources, but I'm looking! If you know anything off hand, or don't mind searching, I'd really appreciate it :)
If your using openGL you should look at using a pick ray with gluUnproject

some more stuff there:
OpenGL FAQ
Quote:Original post by Anonymous Poster
However, it's hard for me to find resources, but I'm looking! If you know anything off hand, or don't mind searching, I'd really appreciate it :)


Diablo II is, as far as I know, isometric. There is a whole bunch of fantastic resources right here on GameDev on this subject.

You might also look in on the Isometric Land forum here as well.

Good luck. Isometrics are not easy IMHO.

This topic is closed to new replies.

Advertisement