Picking on a world map

Started by
1 comment, last by Toni Petrina 19 years, 7 months ago
I have texture which represents my world map (normal texture). I want to know which area cursor is currently over so I've made another texture of same size but using simply two colors : black and white where black is inaccessible area and white accessible area. But I don't know how to use this. I know that I should convert cursor position into map position and check color of pixel and then change cursor. How would you do this.
So... Muira Yoshimoto sliced off his head, walked 8 miles, and defeated a Mongolian horde... by beating them with his head?

Documentation? "We are writing games, we don't have to document anything".
Advertisement
How you convert the cursor's position on the screen into a position on the texture depends on how you are viewing the map. Is it a 3d view, or is it top-down (2d)?

If it's top-down, then it's pretty easy, but you'll have to be more specific if you want an exact answer. If it's 3d then it's more complicated, and involves working out where the cursor is in 3d space and projecting a ray in the view direction.
Sorry, I've should explained it more clearly.

I don't know how to load bitmap image (any format) and check for pixel. I know to do it in DX9, but locking texture, khm. no way.
So... Muira Yoshimoto sliced off his head, walked 8 miles, and defeated a Mongolian horde... by beating them with his head?

Documentation? "We are writing games, we don't have to document anything".

This topic is closed to new replies.

Advertisement