Portal Physics

For the past few days I’ve been trying to make a portal physics like in PORTAL, but, I’ve gone in several issues regarding physics.
When you enter in a portal, the “TELEPORT” function is executed, it keeps current physics stuff, but, it does not “rotate the physics”(explicated in photo), so, imagine this situation:

As you can see, a simple set actor location and rotation would do fine, however, how do I do that preserving physics?

Any ideas?,
Alanzote.

And no, my game is not a portal game.

Hi,

I really have no experience using Physics, but is it a really bad idea to get the velocity, direction, etc (what you need) before you teleport, and then apply these forces again to your actor after the required changes? I’m really not sure if this makes sense, I’m just trying to give some ideas.

I would require to “shift physics direction” which is not possible in UE4… If I could get the relative direction between both portals, I would get on something… like, changing linear velocity… Might work, but it requires a lot of math… let me check it a little.

EDIT: I have no idea how to calculate that.

Here is one solution that could work for you.

Just to clarify the references on ss. The “Tel01” is the portal bp, it have a box collision component and one event dispatcher with the same name “Tel01” that calls the “OnComponentBeginOverlap” event. The “Target” reference is just static mesh ref that gives location and rotation of the teleport target. :slight_smile:

It’s as simple as something like the above - store the incoming velocity on the ‘in’ portal, and then apply the same velocity (adjusted for rotation) on the exit portal. For rigid bodies this may require some minor physics calculations to be done manually (i.e knowing what force to apply to accelerate the object back up to the original velocity).

Your’re idea worked perfectly, I just added a 180 degress(YAW) on the actor rotation and it worked fine! ( Used player current rotation )

Thanks for that, I’ll soon post something about my little portal( This is no reference to the portal game from valve ) game!
Alanzote.

Nice! Good luck on your project. :slight_smile:

:slight_smile: This is a fun one. I recently found this video that you guys should take a look at. Basically, these two play the game portal for a bit then, recreate it in unreal. I skimmed through the video and it looked like they got it working fairly well.