I have a table in my scene with weapons on it, each with their own colliders and tagged as “collectible”. I want the user to be able to collect the item they are hovered over with the mouse when they press “F”. I tried some things and could only make it so it collects all the items on the table…but thats not what i want. how would i make it so only the item under the mouse is collected?
You could post the code so that we might suggest changes, but without the code, the easiest I’d imagine would be to just use a Unity - Scripting API: Camera.ScreenPointToRay in which case you’d just have to check if the object hit by the ray is a item that can be picked up or not… the only problem with that would be that you have to make sure that the cursor is on the object…