Sign in to follow this  
clayrab

When picking, I need to draw elements in reverse order?

Recommended Posts

clayrab    102
Hello everyone,

I'm new on gamedev.net but have lurked here for a while. I am developing a turn based strategy game and am having a strange issue with picking that I'm hoping someone here will be able to clarify.

In order for the top, i.e. viewable, object to be selected when in picking mode, it seems that I need to draw the objects in the reverse order as when I'm in GL_RENDER mode... I'm a bit confused why this would be and am hoping that this is either expected behavior, or that I'm making some common mistake and that someone here might be able to explain.

If I can't figure this out then I can simply track clickable gameboard objects, unclickable gameboard objects, clickable UI objects, and unclickable UI objects separately and then draw them in different orders for each mode, but this is a bit of work and seems quite hacky.

Thanks in advance!
Clay

Share this post


Link to post
Share on other sites
Brother Bob    10344
The hit record contains all hits, no matter what order you draw them in. The order of the hits within the hit record list, on the other hand, depends on the order you draw them, but that does in no way influence the selection itself. You still have to find the appropriate selection among all hits anyway.

Share this post


Link to post
Share on other sites
clayrab    102
Thanks Bob!
That's definitely what's going on. I am only checking the first hit. I just took a closer look at my code, I have a line to confirm that there is only one name for my hit and thought this code was confirming there's only one hit. *facepalm*

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this