Hello,
I’m new to Unreal Engine, and I want my character to teleport only when they are standing on a portal and press the ‘E’ key. How can I make it happen?
You need to add an overlapp box to you portal and add a key binding to the E key
When the player presses E, you check if the portal is overlapping the player and if true you teleport the player
Another way to do it is to create a new Actor blueprint called BP_Portal and add a volume (capsule, box, …) to it, for example a Box Component will do.
In your character blueprint, add a boolean called bStandingOnPortal.
Then, go back to your BP_Portal, click the Box Component and in the details panel, scroll down and look for On Component Begin Overlap with a little ‘+’ icon. Click the ‘+’. It’s going to take you to the events.
Drag the wire out of Other Actor from the box On Component Begin Overlap and choose Cast to MY_CHARACTER_BLUEPRINT_TYPE (choose your blueprint type of character). After the cast, you can use the blue wire to set bStandingOnPortal to True.
Go back to the Box Component’s details and add another event, this time On Component End Overlap and likewise, cast the result of the Other Actor pin to your character blueprint and this time set bStandingOnPortal to false.
Now, you can rely on bStandingOnPortal to know if you are standing on the box.