OH Woe is Me!! Picking not working!

Started by
14 comments, last by Nibbles 22 years, 3 months ago
I once again must agree with Lord Karnus on this issue. Ray casting has got to be the easiest way of detecting if an object has been selected by the mouse in my opinion. I use it in my games all the time, and its great.

Look into it.
Advertisement
Hi wojtos,

I wish I could help you out, sorry. I was wondering though, I noticed your map structure and was wondering how you got x, y and z to be a member of ''tile'' when ''tile'' is a member of ''map''?

-Echo
There is a pretty simple way that I know of... just use colors. Draw each polygon to an off-screen buffer as a different color.. then when you click, get the color of the off-screen buffer, and then you know which polygon it was.. that''s a simple way.. uses a bit more GPU power.. but, is reliable (provided you''re working in true color, or seperate your colors a little bit) and pretty quick since you aren''t texturing or lighting or anything.

Billy
Oh, and i''m assuming his structures are setup like so:

struct Vertex_S
{
float x,y,z;
};

struct Map_S
{
Vertex_S Tiles[32][32]; //Or whatever number
};

Map_S Map;


Billy
Billy,

Thanks for the response. I tried it out and sure enough it worked. That was really beginning to puzzle me

Thanks again.

-Echo

God did not create the world
in 7 days; he messed around for 6 days and then pulled an all-nighter.
Heh, no problem.

Billy

This topic is closed to new replies.

Advertisement