Download

How rotate character momentum relative to exit portal world rotation?

Hey guys. I’ve managed to make a pair of portals, but the world momentum carries through when I need the exit momentum direction to be relative to the exit portal the same way the entry momentum was relative to the entry portal. For example as it is now, when I walk through one portal that is rotated 90 degrees on the Yaw axis I will leave the exit portal and will drift either left or right depending on the rotation direction of the portal. What I need is for when I enter one portal, then no matter the orientation of the other portal I will come out with a momentum that makes sense.
The portals can be moved and placed with in the game, same as in any of the Portal games, so the solution needs to be universally relative to the portal’s current rotation. I want to be able to fall through one portal and come flying out of the other portal at the expected direction.

Currently I am using the default FirstPersonCharacter’s capsule component to work with my momentum. I have been trying to save my velocity as I enter the portal, rotate the velocity by the rotation of the exit portal, stop movement, and reapply the rotated velocity as an Add Impulse, and well it just doesn’t work so I’m obviously missing something.
I’ve tried doing what Nawrot suggested in https://forums.unrealengine.com/deve…otate-velocity but his description isn’t very clear to me and I can’t recreate it.

I just need to get the velocity relative to the entrance portal when the teleport is triggered, and rotate it so that after the player is teleported the momentum will be similar to how momentum is fluent when using Portal 1/2 portals. With consideration that the portals may have virtually any world rotation. Because the portals are identical there also needs to be a Yaw rotation of 180 degrees at the end of the modification or the character will go flying out the back of the exit portal, ignore that last sentence if I didn’t describe it well enough. My portals resemble this https://www.youtube.com/watch?v=F28NKqG7ce8&t=475s but with lots of internal modifications to enable them to be placed anywhere with any rotation and still function. This is the last piece of the puzzle.

Thanks in advance!