Grabbing objects: my thoughts so far

  • Would you use component or inheritance?
    I would use a component called something like GrabObject attached to the Player. That’s my first thought.
    After some googling on inheritance vs component, from what I could understand, if GrabObject is to be used only on the Player, using a derived class would be a good option.
    Without searching for further information, I honestly could not even start to reason about inheritance.

  • How may you know what to grab?
    if a button to execute the grab action is pressed
    if Object is close enough to the Player and can be grabbed (some way to calculate the distance in 3D space between Player and Object; some way to check if Player is facing Object)
    grab object (original Object’s Transform Position is attached to a Transform Position relative (close) to the Player)
    otherwise
    do nothing

  • What game object would you be working with?
    From what I understand so far, we could be working with the Player and the Chair.
    Player: Pawn class object that has a GrabObject function.
    Chair: StaticMeshActor object that has a CanBeGrabbed boolean property.

Privacy & Terms