Blueprint Portals - Control Rotation problem...

Hey everybody,
I have made two Portal2-fake portals, one blue and one orange, and I have already coded it so I can walk into the blue portal and I get out of the orange one, and I see what the orange portals sees if I look into the blue portal. The problem is, If i go into my blue portal, I will get out of the orange portal, but with wrong control rotation. I want that I get into the orange portal and I get out of the blue portal with that rotation as I step exactly out of it (in the same direction like the portal faces…) You know how those portals work :slight_smile:
Heres my BP so far:

Thanks for your help :slight_smile:

I’d be interested to see your portal setup in action as it’s actually something I’ve been trying to do.

As to your problem, why not get the Delta Rot between the current portal and the target portal (i.e. how far apart they’re rotated), and then on teleport use a Set Control Rotation node to set the control rotation to (Get Control Rotation + The Established Offset)?

My guess here would be that what’s happening is that the “Arrow” component doesn’t have the rotation you think it does; it would probably help if you explained exactly HOW the control rotation is wrong. Like, if you place the two portal actors such that walking through them shouldn’t rotate the controller AT ALL, what happens? Do you look up? Left? Is it rolled? When you rotate this portal pair 90° (say from northfacing to eastfacing), is the effect consistent, or does what used to be a “looking up” situation become a “looking right” situation?

Etc .

So i’m in school right now but could you tell me how to do this with the delta rotation? So for the information: The Arrow is pointing in the direction where the player “logicially” should go out, so the arrow is coming out of the portal. If I place one portal at the wall, and the other portal next to it, all works fine, but if I place the one portal at the wall and the other one rotated by 90° somewhere else, I go into the first portal and than I will teleport but my char looks in that direction like I go out of that portal which is at the wall. Sorry for this clumsy detailing, I will put a video on YouTube and send the link in here when I’m @ home :slight_smile:

Ah okay, then yeah, Delta Rot.

Delta Rot subtracts rotators; what you’d do is take the delta rot between the two arrow components, which will tell you how much rotation exists between the two portals. Then you’d add that (using a get control rotation > combine rotators > set control rotation setup) to your current control rotation.

The end effect should be that if the portals are 90° apart, your control rotation shifts 90° to match that. But if you’re looking sideways or backwards or at an angle when you enter the portal, that same relative difference between your control rotation and the portal rotation is preserved (i.e. Back up through the orange portal, come out of the blue portal facing it).

Hmm it’s not working. I just get the 0,0,0 rotation. Heres my BP:

PrintString the rotation specifically from arrow, see what it says. My guess is that isn’t holding a rotation like you think.

Ok done it… So the rotation of the blue portal is exactly 0,0,90 rotated, but the print string of that arrow on the blue portal is P=-5.280975 Y=178.698700 R=0.000000
So the yaw is 180 degrees rotated when the portal is at 0,0,90? So if the portal is at 0,0,0 rotated, it says P=-0.697205 Y=176.546234 R=-0.000000. Strange thing…

Maybe instead of calling the arrow, you could just call Get Actor Rotation. That might help ensure that the rotation value is the one you expect.


Done it like this, but this still not works. Same result as before. I printed the delta before, and that gave out the exact angle between those two, but the control rotation set still not works as I want…

Hey, here’s how I did it, works pretty fine.

But I have to ask now, does anyone know a way to do it for objects as well, and not just the player?

Hey, thanks! This is strange! This value which you substract (180) works only when the portal is at the wall (equals 0,0,90 rotation). If I put my portal at rotation 0,0,0 it sets my control rotation wrong again and I have to set the substract value to 0. Why is this?

Hm, I didn’t notice it did that, I’m trying to figure out a solution now. You subtract 180 to turn the player around, because I ended up backwards in the teleport for some reason.

EDIT:


Subtracting rather than adding seemed to fix it.

Thanks now its working good at my project too! Wouldn’t it be the same for objects but we don’t set the control rotation but the normal actor rotation. When we enter the trigger we could cast to the pawn, and if its not the pawn, we set the actor rotation
and some stuff except of the control rotation - thats how I would to this. I do now the portal shooting things.
EDIT: Do you know how I can set the portal rotation so it lays on the surface where I shot on?

Ok so I fixed that rotation stuff too, but do you know how I can do it so I shoot against a wall and it will spawn with a minimum height so I can see the whole portal?