Character interactions with objects like in Sea of Thieves

Hey

I can help you over Discord as I already see some aspects where your system scales easier.

Though here a couple of things.

  1. I know that you use the LineTrace to get awareness of you´r intractable actor - but I would put awareness into another function by letting the Player check constantly and save the HitResult away. (For instance Event Tick or a Timer) Of course you can filter through a base class or if as you do an interface.

  2. You already have an interface implemented which you are using, at the same time you are accessing the function “Bruecke Runter”. Make it part of your Event On Interact by rotating the object at the time you rotate the lever. (or differently if your mechanic so desires) Your bridge can already be part of your lever in design time, by having an actor variable of type “brigde” and manually add it by exposing the variable, so you can use it in the editor.

  3. If the player is in the state of interacting with your lever, tell your Character Blueprint through an ENUM for instance that it is in that state (interacting for instance), and in your Character Blueprint, create a flow for InputAxis MoveForward, that it sends the AxisValue to the On Interacted. Also use the ENUM in the “Interaction Use” flow, so it can´t trigger anything anymore. (More elegant would it be if you could use your interaction Use instead of the MoveForward)

  4. The ENUM state can then also used to stop movement from the player but Input intaction on the player.

Overall it allows you the following:

  • Any object drives through OnInteracted its behavior
  • The Player or Character Blueprint is aware of its state, either interacting with an object or in a normal movement state.

Meaning, any object can do what ever it wants when interacted and the Player will be always in the appropriate state when interacting.

Hope that helps as an orientation. Again I am happy to help over discord and since you have a function “Bruecke Runter” I guess we can do that in german then ;). My user name is
neryun#6354