I am attempting to do an Assassin's Creed/KotOR style contextual object selection in a FP camera. There are several different types of intractable objects in my scene. For each type, there is a set action that our 'action button' will perform on them. Right now I am trying to create an object detection area in front of the character/camera to populate a list of "available" objects for highlighting or some other unique identifier.
Currently I have added a game object as a child main character out in front of it and put a Capsule Collider on it, which is set to trigger. The scrip on the collider uses the "OnTriggerEnter" to make the detection of objects. This works fine, i get a list of all objects (with colliers on them) that have entered the trigger. However I am looking to refine the selection process even further by only including objects that are "visible" to the player.
Basically,I take the collider that enters the trigger, and get its local position and shot a ray from the center of the trigger to the transform of the collider that entered the trigger. This is causing problems for objects like drawers where the drawers are stacked on top of each other, and the ray hits the top drawer first, while trying to aim for the center of the second drawer (etc).
Is there an easy way to get a point on an objects surface so that I'm not firing to the middle of an objects volume?