Portals - properly rotating outgoing velocity of passing object

I’m making a lightweight portal system which needs to work with multiple objects passing through them. i need it to work with player actor, projectile actors (and eventually line traces, although this will use a different mechanic).

Currently my portals teleport the actor, however the actor velocity is overriding the rotation.

my initial thoughts are to set velocity to zero before making the teleport (i do not want to destroy/spawn the actor) and then reapplying its velocity (recorded on hit) with a new trajectory after the teleport.

In advanced versions i would like to calculate the entry angle and have that reflected from the forward vector of the OutPortal, but for now i would settle just for having it go in the direction of forward vector.


How is the actor’s rotation being set? Is it a character using controller rotation, or using a movement component with OrientRotationToMovement set to true, or something else entirely? Are you testing different kinds of actors?

I’m going to assume you’re having this problem when you teleport a character. If so, your controller is probably overriding rotation if the character has UseControllerRotationPitch/Yaw/Roll set to true.
After the teleport node, try casting your PassingObject to a character and setting its controller’s rotation with SetControlRotation if the cast is successful.

If that isn’t the case, then you could set your velocity after teleport to be Velocity Size * Portal Forward. You don’t need to zero out your velocity before teleporting.

“i would like to calculate the entry angle and have that reflected from the forward vector of the OutPortal” Having some trouble understanding this logically. What are you trying to achieve? If the portal’s forward is north, and an object enters with an angle facing northwest, reflecting it along the portal’s forward would give the object a final rotation facing northeast.

I am using both projectile and characters to test- the rotation is not working for either one. My issue is the variable ‘passing object’ doesn’t have inherent access to movement components as the object can be any actor which hits the portal - meaning i cant “set velocity”.

Should i have function which checks whether passing object is player or projectile and cast to respective actor? plus i will have multiple projectiles, as well as other actors without movement components, such as boxes pushed through the portal- any suggestions with that?

“i would like to calculate the entry angle and have that reflected from the forward vector of the OutPortal” Having some trouble understanding this logically. What are you trying to achieve? If the portal’s forward is north, and an object enters with an angle facing northwest, reflecting it along the portal’s forward would give the object a final rotation facing northeast.

using teleport it spawns the new teleported target at the center of the new portal. for fast turn around purposes this is fine, but i would like to figure it out for the future.