Problems understanding rotations in the Engine (Blueprint)

Hey there!

I’m having issues understanding how rotations work in the engine.
I’m doing a simple Portal prototype to understand Blueprints (most of what I’ve learnt so far has been on C++).

My idea is to teleport the player at the other Portal location with a custom rotation, as explained in the image below:

This is the Blueprint code I’m using:

The idea is to take the rotated portal actor’s normal, get the difference with the player forward rotation, create a rotation that is the Opposite Portal’s rotation with the applied difference, and set the Player rotation to that rotation on Teleport.

Just in case, this is the Actor:

And this is what happens during “gameplay”:

I don’t quite understand what I’m doing wrong.
Could any of you help me out?

Thank you in advance!

What kind of player is it? I ask this because if it’s the first person character, then you need to use ‘set control rotation’, not actor rotation :slight_smile:

1 Like

Thank you for your reply!

It is, indeed, the First Person Character.
Now that you mentioned that, I tried casting the “Other Actor” to BP_FirstPersonCharacter, then “Get Controller” and then “Set Controll Rotation”, but it didn’t work, the result is the same as shown in the video :confused:

Just use a ‘get player controller’ node :slight_smile:

You need to use ‘get control rotation’ in all calculations here… including measuring the difference between the player and door.

You could use a BP interface on the portal to execute an implemented BPI function on the character. Thus let the character teleport itself. This would make working with CMC a lot easier. Just pass the exit portal normal and location to the BPI function.

Now on the character you have direct access to CMC and should have access to a fully casted controller reference.

Calc pawn rotation and move to location, teleport, rotate.

1 Like

First, you shouldn’t need to use normals at all to recreate a rotation.
If you want an absolute world rotation, just … use that rotation.
if you want a relative rotation, you multiply first by the inverse of the source rotation (so you get back to world space) and then multiply by the target rotation (to get it back to that space.)

Second, are you rotating the actor, or the camera/control perspective?