Inheritance and Components will be used!

Here is my take:

We’ll create a vector3 that shoots out of the center of the player camera, with a set distance (The raycast). This will be the player’s “grab distance”. When this ray hits an actor that IS A grabbable object AND a certain key is pressed, this will tell the object that it is in a grabbed state. When this actor is in this state, we’ll set its transform to where the end of this raycast. When the player presses the activate key again, this actor will not be in a “grabbed state” and just drop, as gravity will take effect.

The ray casting and grabbing, the transform getting changed will both be components on the respective actors.
Inheritance will be used to check if the actor is of type “grabbable”.
This is why both will be used.

Privacy & Terms