Here is my thought process on how to make a “Grabbing System”:
- Player would firstly need to be in range in order for raycast to work
- When in range, using an ActionMapping will trigger a raycast
- If that raycast succesfuly hits the valid, pickable object/item, it will store it in memory (in 1 slot inventory)
- When pressing another ActionMapping for dropping the Item/Object, it will check if the player has anything at all
- When true, it will drop the item/object in front of the player
Notes:
- If player tries to pickup invalid items/objects, nothing will happen (although I could add Widgets and such for this case)
- Valid items/objects will be highlighted
- If player tries to drop while holding nothing, nothing will happen (although I could also add another widget for this case)
- If player tries to pickup anything while already holding something, it will exchange the current item for the raycast-hit, valid, item/object and drop the current one like if the player had pressed the “drop” ActionMapping (although if I wanted to save some work, I could probably make it so that you FIRST got to drop the current item/object to grab the new one, otherwise, nothing would happen)