EDIT: Nvm, got it working it seems. Was looking over my code, thinked a bit and removed one line: pnlRenderMouseMove(Sender, [ssLeft], X, Y);
from MouseDown.. event. Because it messed up some things and i just now discovered that i actually implemented better thing in MouseDown.
Basically calling "pnlRenderMouseMove" even in MouseDown was needed for selectionboxes to clean up, so after single click anywhere on map there will be only one selectorbox.
Strike that all.
Working on this thing again after very long break.
I have some problems with selectorboxes. It basically works, but it picks the objects behind the selectorboxes.
It probably has to do with objects Z ordering or something.
It goes through the selectorobjects and picks the tiles behind it.
I can detect the coordinates of the picked selectorbox cube and face of it but for some reason it goes through the selectorboxes. I tried to "pick" them first (by moving code for picking on the top of the code for picking map cubes) and then actual map cubes but it didnt change anything.
I tried to set glDepthMask(FALSE); and true, nothing changed. Just worse.
Im doing the picking like in nxPascal picking demo. Spheres at specific position, if ray touches spheres i loop through selector vertex coords.
Any ideas what should i try? So if ray hits the selectorboxes it will not go behind them.
Here is pic with arrow, behind the arrow it picks the map cubes (the blue / yellow ones). But it shouldn't.
Bookmarks