How about a 3d matrix infront of the players body that checks for interactable objects above, below, and infront of, and does a distance check to see which item is interacted with? Alternate suggestion would be 3 rays originating from the center point of the body, one going down, another forward, the final up. On Wed, Jun 10, 2009 at 10:25 PM, Alan Wolfe <alan.wolfe@xxxxxxxxx> wrote: > Ok so in 2d RPG's it's easy to tell what the player is intending to do when > they press the use button because the world is just one later and everything > is broken up into a grid. > > In our game, since it's real 3d, we could have items like a book on the > ground, or a floating orb, or a book case that the player is trying to use. > > Also, we could have multiple floors of map (like in cavemap how we have the > bridge over the boss area). > > so that makes things harder. Here's what i was thinking for finding out > what the user wants to interact with. > > 1) User presses the "use" key (enter on the keyboard, A on the controller, > whatever) > 2) The game shoots an imaginary ray out of the player that originates in > the middle of their body (ie bellybutton-ish) and goes the direction they > are facing for about a foot of distance > 3) If that ray hit an object, that's the object they are trying to interact > with. > > There could be a problem if there was a book on the ground the player > wanted to "use" since our ray starting at the middle of the body wouldn't > hit the book. > > There could also be a problem if something was floating above the middle of > the body, or if there was a hole in the object that the ray shot through > hehe... > > but, since we have control over where objects are placed we could just be > careful and make sure these cases never came up. > > what do you guys think, think that'd work ok? >