Create drivable vehicle

I am trying to make a vehicle a player can enter and drive around with. I’ve made a box colision on the door of the vehicle that makes a widget apear saying E but this widget seems to appear when I start the game?
Box Collision


Blueprint

Widget

Your box collision probably collides with the car mesh, maybe with the landscape, hard to say without info about how you configured collisions.
Besides optimizing collision profile to not detect what it actually detects, you could use a branch. If “other actor” (on overlap event) is equal to player character, then create widget. You could also cast to the character class and create the widget if the cast succeeds, but it would react to any character coming in the box (AI or other player)

To make the box collision, inside the cars BP I added a box collission, and then added an actor begin and end overlap in the graph.

As Grot13 said, that box collision is overlapping with the ground or even the car mesh and shows the widget.

This logic should be in the player, not in the car blueprint. It’s the player’s job to detect interactive elements around them. What you’re trying to accomplish should be done with interface - do look up how they work and what they offer before diving deeper into this kind of interaction.

Otherwise you’ll be redoing the whole thing very soon…

1 Like

After messing around with the blueprint Interface, I have managed to make the player possess the vehicle and drive around, I just still have the problem with the widget appearing when the player hasn’t even touched the box collision

The collision (sphere) should be on the player, or use tracing if you want to focus on what’s in front of them. Collision filtering offers a lot granularity when deciding who can collide against whom:

And new custom channels / object types can be added, too:


Technically you could achieve what you need without filtering, using just interfaces but it’s highly recommended to get used to channels / objects.

When the player detects something on begin overlap, use the interface to send a message. If the target actor has the pertinent functionality implemented, it will react. Otherwise nothing happens and things fail quietly - the beauty of interfaces.

Hi, I have a little understanding of what I need to achieve here but do you think you could show me an example of what I need to do inside the editor?

If you scroll to the 2nd answer I left for this question:

and search for this bit:

  • an interface has a bunch of generic functions that do nothing

There will be all the examples (and more) you’ll need to get it to work.

Not sure what the issue is then, do explain how you set it up:

  • let’s say this is the player sending the interface message:

  • this is the car reacting to the call:

This way you can have the car pop a widget.


But you can keep the widgets handled by the player. Have the interface function return what type of object we’ve interacted with.

  • if this is the function implementation on the car:

  • the player can do what they need with this info:

The above is crude but that’s the gist.