Lecture 68 - Grabbing System Overview - Ideas

building-escape

#1

When it comes to grabbing objects in our world my preference would probably be towards using a component rather than inheritance.
With inheritance I imagine that you would need to know beforehand that a certain object will need to have the ability to be picked up, so to make it child of a parent of things that can be picked up.
In my mind using components might make the process easier if I change my mind about an object I’ve already created. I could simply add the “pick up” component to it, rather than have to recreate it using the proper inheritance.
Having said that, you could possibly make all objects a child of a “pickup-able” parent and use a boolean to decide whether you can pick the item up or not. I just think using a component might be easier in the long run.

In order to know what items to “grab-able”, there could be a visual queue of some kind (this could appear when the player gets within a certain range of the object), or the player may have to press a button to grab the object (if the item is “grab-able” it will work, otherwise it will not) and release the button (or press it again) to drop the item.


#2

I also prefer to use a component rather than inheritance. If I knew more of what I was doing and had spent more time in design so that I knew what items would be grab able or if there were so many items that were grabable, such as in an Elder Scrolls game, then I would think inheritance would be a better solution. Originally I thought using a trigger volume would be the best approach for this system until I started to consider what, if the player was in an area with multiple overlapping volumes. How would I decide which object was interacted with? My solution to that problem was to use a raycast to determine which object the player was looking at. But If I am using a raycast to decide what object to interact with, why not use a raycast instead of a trigger volume? A UI cue stating “Pick UP” would be one solution to let the player know that an object is grab able. Later an effect could be applied to the chair, such as an aura, that will help the player know which object is being interacted with.