It looks like you're new here. If you want to get involved, click one of these buttons!
orxVECTOR objectPickVector;
objectPickVector.fX = 878;
objectPickVector.fY = 1185;
objectPickVector.fZ = -1.0;
orxOBJECT *objectToPick = orxObject_Pick(&objectPickVector, orxU32_UNDEFINED);
orxOBOX boxArea;
orxVECTOR pivot;
pivot.fX = 0;
pivot.fY = 0;
pivot.fZ = 0;
orxVECTOR position;
position.fX = 848;
position.fY = 1130;
position.fZ = -0.1;
orxVECTOR size;
size.fX = 70;
size.fY = 70;
size.fZ = 1; //1 or 0?
orxOBox_2DSet(&boxArea, &position, &pivot, &size, 0);
const orxOBOX area = ballBoxArea;
orxOBJECT *objectToSelect = orxObject_BoxPick(&area, orxNULL);
Comments
It seems to me that the problem is that you are assuming that the first group id will be 0. I had a similar problem... when I was investigating I found that group ids are kinda random (I think they are a hash index). In my game I use this code to find the actual ids:
Here is the output:
[14:12:20] [LOG] Group id 0 is 3300827270.
[14:12:20] [LOG] Group id 1 is 1350410992.
[14:12:20] [LOG] Group id 2 is 4061751890.
[14:12:20] [LOG] Group id 3 is 2741597886.
[14:12:20] [LOG] Group id 4 is 1722803689.
[14:12:20] [LOG] Group id 5 is 1545706559.
If I get no joy, I'll try your routine.
orxCamera_GetGroupID(camera, 1);
As I was only concerned with the group on index 1. But I like your system if you have multiple groups to deal with.
The only problem is that you need to have the enum in the same order as the groups order in the ini file.
Here's an example from one of my current projects:
Config:
As you can see, I don't want the picking to consider objects from the following groups: Background, Foreground, Overlay and Cursor.
In addition, I can pick objects from a group called Back which is actually not rendered (in my case, there's a single object covering the whole screen, catching the "lost" clicks as I still want to do some processing on those).
And here's my picking code:
As you can see it's very similar to Knolan's logic. The other difference, which relies on a function I added to Scroll a few days ago, is when __TOUCH__ is defined.
I do picking at a given position + a list of offsets if nothing's found at the precise position. My offsets are a bit to the left, a bit to the right, a bit above and a bit below.
That makes life easier for users with big fingers on tiny screens.