How do I create some kind of Portal Gun with UEFN?

Im trying to create a portal gun but right all i can do shoot the wall and teleport to that wall but i want to create actual portals which i can walk trough. Also i cant really go to the position where the bullet is going. Is there anyone who could explain how to do this?

…how did you do the first part? I don’t even know of a way to create custom weapons tbh… is it just a regular weapon hitting a Trigger, and the Trigger is set to fire on Damage?

To make an actual portal, you could spawn a Teleporter device at the point of impact. If that works. I’m not even sure how you did the existing work though, short of making your own manual weapon/projectle/collision system in code. If that’s what you did then spawning a teleporter device with an invisible base might be obvious, apologies if so :sweat_smile:

But how is the script gonna know where and when i hit the wall?

I don’t know, like I said I don’t know how you even did the first part… the only way to teleport the player is with Respawn right, so you must have gotten a Translation already somehow…?

No i just placed triggers with a teleport then when the trigger gets triggered via a gun player teleports to the teleporter.

Ok well the only way I can think of to get “hit location” of a weapon shot is to strategically place Triggers on your walls that are set to be triggered by Damage, and then use your pre-existing knowledge of the Trigger size + some spatial math (e.g. get the Reflection vector, move 100 units away from the trigger) then spawn a portal at that location.

Basically would have to use TriggeredEvent on trigger_device, where the trigger_device is a “hitbox” for the wall; then get the location of the Agent who caused the event; then do some Vector3 stuff to find a space between the player and the hitbox where you can spawn the portal. As close to the hitbox as possible, but not actually inside the wall - that is the hard part, and will likely involve you building your map with simple shapes and some kind of grid.

You are basically writing your own “collision and raycast” code here. It’s not simple, but not impossible.

I’m sure we will get more Verse stuff to make this kind of thing a bit easier in future.

2 Likes